Socket
Socket
Sign inDemoInstall

trailpack-router

Package Overview
Dependencies
14
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    trailpack-router

Trailpack Router


Version published
Weekly downloads
33
increased by450%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

trailpack-router

Gitter NPM version Build status Dependency Status Code Climate Follow @trailsjs on Twitter

Trailpack Router. Aggregates all routes from config.routes to create hapi.js route objects.

Usage

Load from your trailpack config. (This pack is included by default).

// config/main.js
module.exports = {
  // ...
  packs: [
    require('trailpack-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' ]
    }
  }

Footprints and Policies

Support for Footprints and Policies is provided by trailpack-footprints.

Compatible Trailpacks

Contributing

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

License

MIT

Keywords

FAQs

Last updated on 19 Nov 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc