Skip to content

Change pattern of route parameter #1114

Answered by e3dio
rtritto asked this question in Q&A
Discussion options

You must be logged in to vote
const param = str => str.replace('[', ':').replace(']', '');

app.get(param('/item/[id]'), (res, req) => {
   res.end(req.getParameter(0));
});

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rtritto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants