Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.