🔧 This Hapi plugin loads all routes in the given directory and registers them on your Hapi server
index.js and files starting with a _ are ignored
yarn add hapi-devine-mongodb
register this module as a plugin in Hapi
server.register({
register: require(`hapi-devine-routes`),
options: {
path: path.join(__dirname, `routes`) // routes directory (required)
log: true // provide logs (optional, default: true)
}
}, pluginHandler);
The files in your routesDir should return valid Hapi routes (array of route objects / 1 route object).
MIT