feature-flags

Access control for express-based node apps

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
feature-flags
0.0.211 years ago11 years agoMinified + gzip package size for feature-flags in KB

Readme

README
Feature Flags
PRE-ALPHA. USE WITH CAUTION. Or not, I'm a README, not a cop.

This module lets developers set user levels and restrict access to features based on said levels. It also provides a web interface to customise those levels without pushing addtional code or restarting the server. Currently, Feature Flags only supports restriction by url.

How-to

You know those weird bits of code that go something like this?

app.get('/', routes.index);

Boring as all get out. Spice up your file with a little Feature flags:

var ff = require('feature-flags');

Now that the life of the party's here, switch out those silly strings for some FUNCTIONS!

app.get(ff.requireLevel('admin', '/'), routes.index);

Now we're talking. Notice the two parameters. The first is the level required ('admin'), the second is the path ('/'). Here, we're only allowing admins at root. Hardcore.

Now, you'll need to let Feature Flags actually route some things around, or else it'll get angry. To pacify Feature Flags, add the following to app.configure call (you did require it?):

    app.use(ff.router);

After all that, you can call ff.init(); if you'd like, but that function's empty right now .

Requirements

You'll need MongoDB on your localhost, and your app needs to run express.

This is the pre-alpha release, so expect these requirements to loosen in the future. If you've got a particular configuration you'd like me to support, open an issue.

License

Feature Flags is released under GPL3.

Todo: tests documentation load config defaults ff.jade (moreso) Simple find-and-replace script to allow for easy upgrade