diff --git a/hapiserver.js b/hapiserver.js index ee3015e..f96a351 100644 --- a/hapiserver.js +++ b/hapiserver.js @@ -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; } }); @@ -25,4 +26,4 @@ server.start((err) => { throw err; } console.log('Server running at:', server.info.uri); -}); +}); \ No newline at end of file