Created
September 23, 2015 17:58
-
-
Save jsloyer/9961c59eeb2cb876443b to your computer and use it in GitHub Desktop.
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
function authenticate() { | |
return function(request, response, next) { | |
if (request.headers["secret"] !== "supersecretkey") { | |
response.send("Must authenticate"); | |
return next(); | |
} | |
}; | |
} | |
app.get("/secured-api", authenticate(),function (request, response) { | |
//do stuff | |
response.send("your response"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment