Created
November 4, 2012 22:35
-
-
Save makensi/4014080 to your computer and use it in GitHub Desktop.
An example of params.
This file contains 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
// 1 2 2.1 2.2 2.3 2.4 | |
app.param("id", function(request, response, next, id){ | |
// we check our id value using a function | |
if(myCheckerFunction(id)){ | |
// we call next to continuing with execution to /post/:id route | |
next(); | |
}else{ | |
next(new Error('Incorrect id')); | |
} | |
}); | |
// ... | |
app.get("/post/:id", function(request, response){ | |
... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment