Skip to content

Instantly share code, notes, and snippets.

@apipkin
Created August 18, 2014 14:39
Show Gist options
  • Save apipkin/235af20a372a9942b886 to your computer and use it in GitHub Desktop.
Save apipkin/235af20a372a9942b886 to your computer and use it in GitHub Desktop.
Simple hapi.js JSON "Hello world"
var Hapi = require('hapi'),
server = new Hapi.Server(3001);
server.route({
path: '/{name?}',
method: 'GET',
handler: function (req, rep) {
rep({
greeting: 'Hello, ',
name: req.params.name || 'world',
punctuation: '!'
});
}
});
server.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment