Skip to content

Instantly share code, notes, and snippets.

@matmar10
Last active August 29, 2015 14:13
Show Gist options
  • Save matmar10/a132b5b4cbed342124c9 to your computer and use it in GitHub Desktop.
Save matmar10/a132b5b4cbed342124c9 to your computer and use it in GitHub Desktop.
Express middleware the easy way with Passport
var sendEmailMiddleware = require('./middleware/send-email');
app.post('/user/:id',
passport.authenticate('bearer'),
lookupUser,
validatePostBody,
mergeUser,
saveUser,
sendEmailMiddleware('user-updated'),
returnSuccess);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment