Skip to content

Instantly share code, notes, and snippets.

@bingeboy
Last active August 29, 2015 14:01
Show Gist options
  • Save bingeboy/5f3fd37248fbc75d4fcf to your computer and use it in GitHub Desktop.
Save bingeboy/5f3fd37248fbc75d4fcf to your computer and use it in GitHub Desktop.
example of a hapi handler
var Hapi = require('hapi');
var server = new Hapi.Server();
// Handler in top level
var status = function () {
this.reply('ok');
};
server.route({ method: 'GET', path: '/status', handler: status });
// Handler in config
var user = {
cache: { expiresIn: 5000 },
handler: function () {
this.reply({ name: 'John' });
}
};
server.route({ method: 'GET', path: '/user', config: user });
@bingeboy
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment