connect-dipswitch
v1.0.0
Published
Connect/Express middleware for Dipswitch.
Downloads
3
Readme
connect-dipswitch
Connect/Express middleware for Dipswitch.
Installation (via npm)
$ npm install connect-dipswitch --save
Usage
var express = require('express'),
dipswitchMiddleware = require('connect-dipswitch'),
app = express();
app.use(dipswitchMiddleware({
redis: require('redis').createClient(),
getTenantId: function (req) {
// default implementation
return req.user.tenantId;
},
getUserId: function (req) {
// default implementation
return req.user.id;
},
getUserGroups: function (req) {
// default implementation
return req.user.groups;
}
}));
app.get('/', function (req, res, next) {
if (!req.dipswitch.EXAMPLE_FEATURE) {
return next();
}
res.send('Hello World');
});
app.listen(3000);