Created
July 31, 2015 07:19
-
-
Save tjoskar/c87858ee8ef27c33e0e3 to your computer and use it in GitHub Desktop.
Register Hapi routers
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 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