Skip to content

Instantly share code, notes, and snippets.

@tjoskar
Created July 31, 2015 07:19
Show Gist options
  • Save tjoskar/c87858ee8ef27c33e0e3 to your computer and use it in GitHub Desktop.
Save tjoskar/c87858ee8ef27c33e0e3 to your computer and use it in GitHub Desktop.
Register Hapi routers
var path = require('path');
var routePrefix = '_router';
var exports = module.exports;
/**
* Register all sections routes
* @param {exports.Server} server
*/
exports.registerRouts = function(server: hapiServer) {
var sections = ['movies', 'auth', 'series'];
sections.forEach(function(section) {
try {
var route = require(path.join(__dirname, section, section + routePrefix));
server.route(route);
} catch(error) {
console.error('Unable to load routs for ' + section);
throw error;
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment