Last active
August 29, 2015 14:21
-
-
Save nikolasleblanc/3e3940c8e7f558a00945 to your computer and use it in GitHub Desktop.
Express middleware with additional arguments
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 tryThis(myString) { | |
return function(req, res, next) { | |
req.heyThere = myString; // should be set to "OH YEAH!" | |
next(); | |
}; | |
} | |
app.get("/", tryThis("OH YEAH!"), function(req, res) { | |
console.log(req.heyThere); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment