A rich framework for building applications and services

hapi enables developers to focus on writing reusable application logic instead of spending time building infrastructure.

$ npm install hapi

Current version: 13.4.1 ● Latest update: 2016-05-27T18:16:34Z ● Downloads last month: 187,459

Community

hapi's stability and reliability is empowering these companies today:

See more

Are you using hapi too? Let us know.

Visit us on IRC in #hapi on freenode.

Getting started

Start by creating a package.json:

npm init

Install hapi and save it to your package.json dependencies:

npm install hapi --save

Create aserver.js file with the following contents:

'use strict';

const Hapi = require('hapi');

// Create a server with a host and port
const server = new Hapi.Server();
server.connection({ host: 'localhost', port: 8000 });

// Add the route
server.route({ method: 'GET', path:'/hello', handler: function (request, reply) {

return reply('hello world'); } });

// Start the server
server.start((err) => {

if (err) {
throw err; } console.log('Server running at:', server.info.uri); });

Launch the application by running npm start and open localhost:8000/hello in your browser.

Read more about getting started with hapi