Skip to content

Ensures changes to user custom data don't overwrite unrelated data due to staleness

License

Notifications You must be signed in to change notification settings

Peekeet/express-stormpath-enqueuer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

express-stormpath-enqueuer

npm version npm downloads

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);
});

About

Ensures changes to user custom data don't overwrite unrelated data due to staleness

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published