Hapi.js 是一個用來構建基於 Node.js 的應用和服務的富框架,使得開發者把重點放在便攜可重用的應用邏輯而不是構建架構。內建輸入驗證、緩存、認證和其他 Web 應用開發常用的功能。
示例代碼:
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();
附上github地址 https://github.com/spumko/hapi