0.1.2 • Published 6 years ago

fastify-register-timeout v0.1.2

Weekly downloads
22
License
MIT
Repository
github
Last release
6 years ago

fastify-register-timeout

Greenkeeper badge Build Status JavaScript Style Guide

Register fastify plugin with a timeout

NB: this plugin is going to DEPRECATED because it suggests a bad approach.

Install

npm i --save fastify-register-timeout

Usage

Registering this plugin

fastify.register(require('fastify-register-timeout'), {
  timeout: 5000 // ms
})

to use like this

fastfiy.registerWithTimeout(require('some-async-plugin'))

NB: in case of timeout, an exception is thrown with the function name as message. This is mean that the anonymous function should not be used here!

Why

There're two reason for this plugin:

  • in some case you need to know if your external dependencies are reachable before starting your server.
  • during the test, you need to know which plugin fails