Last active
May 31, 2016 09:39
-
-
Save samcorcos/472e50b06e8dcf35dd3e4855eb770f64 to your computer and use it in GitHub Desktop.
Auth middleware
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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