Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

fastify-blipp-log

1.0.2 • Public • Published

fastify-blipp-log

Prints your routes to the console (using internal or custom a log) each time your server starts. (inspired by fastify-blipp fastify-blipp plugin and blipp hapijs plugin)

install

npm i fastify-blipp-log

usage

It is important to register the plugin as soon as possible, so it starts to listen for the new routes.

const prettyRoutes = require('fastify-blipp-log').default
const fastify = require('fastify')({
    logger: {
        prettyPrint: { colorize: true }
    }
})
 
fastify.register(prettyRoutes)
 
fastify.all('/cats', async () => ({}))
 
const start = async () => {
    try {
        await fastify.listen(3000)
        fastify.prettyPrintRoutes()
    } catch (err) {
        console.error(err)
        process.exit(1)
    }
}
 
start()

Output

image

Options

  • customLogger : You can pass a custom logger instance, by default it uses fastify logger. Optional
  • tabLength: Change the tab size between the method and the route, by default is 13. Optional

Credits

I couldn't do this without this awesome libraries, so thanks to all:

License

Licensed under the ISC license. 2019

Install

npm i fastify-blipp-log

DownloadsWeekly Downloads

12

Version

1.0.2

License

ISC

Unpacked Size

86 kB

Total Files

25

Last publish

Collaborators

  • avatar