Closed scf4 closed 7 years ago
Hey that's right, the regex stops at the first hyphen and assigns the rest to id
. You can define the route like this to avoid it:
/post/:slug-:id([^-]+)
It uses path-to-regexp to match the routes, check it out for more examples. The reason that it works on the client is that the URL is only a decoration there and is not used for matching params.
I have the route
/post/:slug-:id
. It works fine on the client, but when SSRing I get a 500 error if the slug has a hyphen in it. I think it interprets the :id as the first thing after the first hyphen.