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
本文地址:https://www.stayed.cn/item/25109
转载请注明出处。
本站部分内容来源于网络,如侵犯到您的权益,请 联系我