spool-router
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-alpha.1 • Public • Published

spool-router

Gitter NPM version Build status Dependency Status Code Climate Follow @fabrix-app on Twitter

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

Contributing

We love contributions! Please see our Contribution Guide for more information.

License

MIT

Package Sidebar

Install

npm i spool-router

Weekly Downloads

1

Version

1.0.0-alpha.1

License

MIT

Unpacked Size

8.5 kB

Total Files

15

Last publish

Collaborators

  • scottbwyatt