I am looking at making a simple hello world with the hapi.js tutorial.
I have installed hapi:
npm init
npm install hapi --save
- I get a large set of folders with files
I tried doing node index.js
and that gave me errors. So I cd
into node_modules
and got another error when running node
. I cd
again into hapi
and again got an error when running node index.js
. I added all of the syntax from the tutorial.
var Hapi = require('hapi');
var server = new Hapi.Server();
server.connection({
host: 'localhost',
port: 8000
});
// Add the route
server.route({
method: 'GET',
path:'/hello',
handler: function (request, reply) {
reply('hello world');
}
});
// Start the server
server.start();
Not sure where I should be running index.js