Answer the question
In order to leave comments, you need to log in
How to set a route with a colon (:) in Express.js?
It is required to configure express to respond to a request like GET /s/x:y:z
But there is a problem, because the colon is used in the named parts of the route.
A construction like /s/x\:y\:z doesn't work for some reason :(
Answer the question
In order to leave comments, you need to log in
I found a solution - as a template, you need to use not a string, but a regular expression.
That is, not and not , butapp.use('/s/x:y:z')
app.use('/s/x\:y\:z')
app.use(/^\/s\/x\:y\:z$/)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question