Package Exports
- hapi-router
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hapi-router) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Opinionated route loader for hapi.
Setup
$ npm install hapi-router
server.register({
register: require('hapi-router')
options: { routesDir: __dirname + '/routes/' }
}, function (err) {
if (err) throw err;
});
Options
The following required options
should be provided at registration:
routesDir
: the path to your routes directory
Specifying Routes
Any .js
files in your routes directory will be loaded - supports nested routes
Example route file:
module.exports = [
{
path: '/test1',
method: 'GET',
handler: function (request, reply) {
reply('hello');
}
},
{
path: '/test2',
method: 'GET',
handler: function (request, reply) {
reply('hello');
}
}
]