fastify-feature-flags
Fastify feature flags plugin. By default it has built-in provider for config
module. However it could be extended by various plugins that implement simple interface.
ToC
Fastify support
- v1.x.x - supports
>= fastify-1.0.0
, including v2.x.x
versions.
Installation
npm i fastify-feature-flags --save
Back to top
Features and requirements
- Requires fastify
>=1.0.0
. - Node.js
>=8.9.0
.
Back to top
Usage
Add it to your project like regular fastify plugin. Use register
method and pass options to it.
const fastify = require('fastify');
const app = fastify();
const ffPlugin = require('fastify-feature-flags');
app.register(ffPlugin, {providers: [new ffPlugin.ConfigProvider()]});
Plugin adds an object with built-in providers and generic provider interface that you can extend. For checking features availability it adds two methods: fastify.featureFlags.isEnabled
which returns true
or false
and fastify.featureFlags.checkEnabled
which throws an error if feature is disabled.
Back to top
Docs
See docs.
Back to top
Changelog
See changelog.
Back to top
See also
Back to top
License
Licensed under MIT.
Back to top