tatethurston / nextjs-routes

Type safe routing for Next.js
MIT License
578 stars 21 forks source link

Allow trailling slashes #168

Closed piotrgrundas closed 6 months ago

piotrgrundas commented 1 year ago

Currently, the lib always strips the trailing slashes when using route function.

I would expect that it respects the next config trailingSlash or at least respect some flag for determining if the trailing slash should be stripped or not.

This leads to unnecessary redirects if someone uses trailingSlash: true.

tatethurston commented 1 year ago

Thanks @piotrgrundas agreed that the ideal behavior is to use the next config value. I’d accept a PR for this.

For any future contributors:

The trailing slash would need to be generated here. The link above is the wrong location -- that is for type generation, though an argument could be made that trailingSlash should be represented in the generated types as well.