Decorates fastify instance with a map of routes
Switch branches/tags
Nothing to show
Clone or download
Latest commit e844686 Oct 2, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test Initial Sep 28, 2018
.editorconfig Initial Sep 28, 2018
.gitignore Initial Sep 28, 2018
.travis.yml Update .travis.yml Oct 2, 2018
LICENSE Initial Sep 28, 2018
README.md Initial Sep 28, 2018
package.json Initial Sep 28, 2018
plugin.js Initial Sep 28, 2018

README.md

fastify-routes

Greenkeeper badge

JavaScript Style Guide Build Status

This plugin decorates Fastify instance with routes which is a Map of registered routes. Note that you have to register this plugin before registering any routes so that it can collect all of them.

Example

fastify.register(require('fastify-routes'))

fastify.get('/hello', opts, (request, reply) => {
  reply.send({ hello: 'world' })
})

console.log(fastify.routes)

/* will output a Map with entries:
{
  '/hello': {
    get: {
      method: 'GET',
      url: '/hello',
      schema: Object,
      handler: <Function>,
      prefix: <String>,
      logLevel: <String>,
      bodyLimit: <Number>
    }
  }
}
*/

License

MIT License