Created
August 18, 2014 14:39
-
-
Save apipkin/235af20a372a9942b886 to your computer and use it in GitHub Desktop.
Simple hapi.js JSON "Hello world"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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