Replies: 1 comment
-
const param = str => str.replace('[', ':').replace(']', '');
app.get(param('/item/[id]'), (res, req) => {
res.end(req.getParameter(0));
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
rtritto
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How to change the pattern of route parameter from
:param
to[param]
?With
req.getParameter(0)
, I need to get the id value from the route/item/[id]
.Beta Was this translation helpful? Give feedback.
All reactions