Wondering what’s next for npm?Check out our public roadmap! »

    fastify-routes

    3.0.1 • Public • Published

    fastify-routes

    CI workflow JavaScript Style Guide

    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

    const fastify = require('fastify')()
     
    fastify.register(require('fastify-routes'))
     
    fastify.get('/hello', {}, (request, reply) => {
      reply.send({ hello: 'world' })
    })
     
    fastify.listen(3000, (err, address) => {
      if (err) {
        console.error(err)
        return
      }
      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

    Install

    npm i fastify-routes

    DownloadsWeekly Downloads

    9,706

    Version

    3.0.1

    License

    MIT

    Unpacked Size

    6.85 kB

    Total Files

    8

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar