Skip to content

Instantly share code, notes, and snippets.

@makensi
Created November 4, 2012 22:35
Show Gist options
  • Save makensi/4014080 to your computer and use it in GitHub Desktop.
Save makensi/4014080 to your computer and use it in GitHub Desktop.
An example of params.
// 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