Hapi.jsNode.js 服務(wù)器端框架
Hapi.js 是一個(gè)用來構(gòu)建基于 Node.js 的應(yīng)用和服務(wù)的富框架,使得開發(fā)者把重點(diǎn)放在便攜可重用的應(yīng)用邏輯而不是構(gòu)建架構(gòu)。內(nèi)建輸入驗(yàn)證、緩存、認(rèn)證和其他 Web 應(yīng)用開發(fā)常用的功能。
示例代碼:
var Hapi = require('hapi');
// Create a server with a host and port
var server = new Hapi.Server('localhost', 8000);
// Add the route
server.route({
method: 'GET',
path: '/hello',
handler: function (request, reply) {
reply('hello world');
}
});
// Start the server
server.start();評論
圖片
表情
