Skip to content

Instantly share code, notes, and snippets.

@samcorcos
Last active May 31, 2016 09:39
Show Gist options
  • Save samcorcos/472e50b06e8dcf35dd3e4855eb770f64 to your computer and use it in GitHub Desktop.
Save samcorcos/472e50b06e8dcf35dd3e4855eb770f64 to your computer and use it in GitHub Desktop.
Auth middleware
module.exports = function(req, res, next) {
console.log("Checking authorization header...")
var auth = req.headers['authorization']
if (auth !== "false") {
next()
} else {
res.status('401').send("Unauthorized")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment