Skip to content

Instantly share code, notes, and snippets.

@martinnormark
Created March 26, 2016 06:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinnormark/077c4455b53567dd85f9 to your computer and use it in GitHub Desktop.
Save martinnormark/077c4455b53567dd85f9 to your computer and use it in GitHub Desktop.
Load routes from separate files with hapi.js
module.exports = [
{ method: 'GET', path: '/users', handler: function () {} },
{ method: 'GET', path: '/users/{id}', handler: function () {} }
];
---
var cart = require('./cart');
var user = require('./user');
module.exports = [].concat(cart, user);
---
var routes = require('./config/routes');
...
server.route(routes);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment