express-stormpath-enqueuer
v0.3.1
Published
Ensures changes to user data don't overwrite unrelated data due to staleness.
Downloads
13
Readme
express-stormpath-enqueuer
Ensures changes to user custom data don't overwrite unrelated data due to staleness.
Installation
$ npm install express-stormpath-enqueuer
Usage
Initialize
var express = require('express');
var stormpath = require('express-stormpath');
var stormpathEnqueuer = require('express-stormpath-enqueuer');
var app = express();
app.use(stormpath.init(app, {...}));
stormpathEnqueuer.init(app);
Modify User Data
app.use(stormpath.loginRequired);
app.use(stormpathEnqueuer.populate);
app.get('/', function(req, res, next) {
var callbacks = {
modify: function(customData) {
customData.myProperty = 'something useful';
},
onComplete: function(err, customData) {
console.log('DONE');
next();
}
}
req.stormpathEnqueuer.modifyCustomData(req.user.href, callbacks);
});