您的位置:首页 > Web前端 > Node.js

Node.js 服务器端应用开发框架 -- Hapi.js

2014-07-29 00:00 731 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: