spool-router
v1.0.0-alpha.1
Published
Spool - Router for Fabrix
Downloads
2
Maintainers
Readme
spool-router
Spool Router. Aggregates all routes from config.routes
to create hapi.js route objects.
Usage
Load from your spool config. (This pack is included by default).
// config/main.js
module.exports = {
// ...
spools: [
require('spool-router').Router
]
}
Configure
config.routes
The list of route objects to be compiled for use by the webserver.
// config/routes.js
module.exports = [
{
method: [ 'GET' ],
path: '/example/test',
handler: 'ExampleController.test'
}
]
During initialization, for the above example, a route object will be compiled that takes the following form:
{
method: [ 'GET' ],
path: '/example/test',
handler: 'ExampleController.test',
config: {
pre: [ 'ExamplePolicy.test' ]
}
}
tapestries and Policies
Support for tapestries and Policies is provided by spool-tapestries.
Compatible Spools
- spool-express
- spool-hapi (TODO)
- spool-koa (TODO)
Contributing
We love contributions! Please see our Contribution Guide for more information.