Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions hapiserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
const Hapi = require('hapi');

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

// Add the route
server.route({
method: 'GET',
path:'/',
handler: function (request, reply) {
return reply('Hello World!').header('Connection', 'close');
path:'/',
handler: function (request, h) {
const response = h.response('Hello World!');
response.header('Connection','close');
return response;
}
});

Expand All @@ -25,4 +26,4 @@ server.start((err) => {
throw err;
}
console.log('Server running at:', server.info.uri);
});
});