mardi 31 mars 2015

Getting started with hapi js

I am looking at making a simple hello world with the hapi.js tutorial.


I have installed happy-



  1. npm init

  2. npm install hapi --save

  3. 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 happi 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


Aucun commentaire:

Enregistrer un commentaire