Skip to content

Instantly share code, notes, and snippets.

@anymaniax
Created January 6, 2017 16:34
Show Gist options
  • Save anymaniax/3ba3b1b188e079c6976b23413a6bd058 to your computer and use it in GitHub Desktop.
Save anymaniax/3ba3b1b188e079c6976b23413a6bd058 to your computer and use it in GitHub Desktop.
module.exports.requireId = (req, res, next) => {
if(!req.decode || req.decode._id !== req.params.id || req.decode.role !== 'admin'){
return res.json({
success: false,
message: 'Failed to Authentication'
});
}
next();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment