-
Hi, router.get('/*.:postId', (req, res, next) => {
//some code here
}) I used regex to allow the request in format: /some-slug-string.postId (ex: /apple-iphone-8.9921785). The parameter should point to the part after [.] (postId) only. Unfortunately it doesn't seem to work in native uwebsocketjs router's path or I just did it wrong.I came up with the alternative solution which was to define a single "universal" router like |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
for the built-in router you should do: .get('/:phone/9921785', (res, req) => { const phone = req.getParameter(0) }) or .get('/:phone/:id', (res, req) => { const phone = req.getParameter(0), id = req.getParameter(1) }) |
Beta Was this translation helpful? Give feedback.
-
I guess you're misunderstanding something. |
Beta Was this translation helpful? Give feedback.
-
That would be /:whatever/9921785. There is no routing with "dot separator" only slash. So you either have to do it yourself in a get /* route or change from dot to slash. |
Beta Was this translation helpful? Give feedback.
-
Alright thanks for your reply! |
Beta Was this translation helpful? Give feedback.
That would be /:whatever/9921785. There is no routing with "dot separator" only slash. So you either have to do it yourself in a get /* route or change from dot to slash.