You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.The text was updated successfully, but these errors were encountered: