Home >Web Front-end >JS Tutorial >Node.js server-side application development framework -- Hapi.js_node.js

Node.js server-side application development framework -- Hapi.js_node.js

WBOY
WBOYOriginal
2016-05-16 16:40:572069browse

Hapi.js is a rich framework for building Node.js-based applications and services, allowing developers to focus on portable and reusable application logic rather than building architecture. Built-in input validation, caching, authentication, and other features commonly used in web application development.

Sample code:

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();

Attach the github address https://github.com/spumko/hapi

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn