express-feature-flag
Feature Flag system as an express.js middleware.
Installation
npm install express-feature-flag
Usage
app; // returns a middleware function
Middleware Options
contextGenerator
Function(req, callback) [optional]
An asynchronous function to generate context
which will then be used as an argument to feature flag rules.
If not supplied, context
will be req
.
ruleGenerator
Function(callback) [required]
An asynchronous function to generate rules.
callback's first argument is error
and second argument is rules
. rules
have to be an object whose names are the name of rules and values are functions that takes context
and returns boolean
.
rules
Example:
{ if contexttype === 'admin' return true; return false; }
ToDo
- Include basic rule spec
Changelog
v0.1.3
- Added stricter type checking to FeatureFlagCollection
v0.1.0
- Initial release
Contributors
- Young Kim aprilrd8943@gmail.com
License
ISC License