Open lydell opened 5 years ago
Yep as you can see I was planing on migrating to path-to-regexp, but I didn't manage to make it work on my first try for some reason. I agree it would be nice to finish this. I'll have a look. Of course, you are welcome to open a PR for this :)
One thing that stopped me from making a PR is that the functions returned by compile
throw errors when given invalid/missing data, while today’s implementation seems to never throw errors. So we need to decide what the API should look like (does it throw errors?) and if it’s a breaking change etc.
Like in this branch: https://github.com/gvergnaud/nextjs-dynamic-routes/tree/use-pathtoregexp
This way advanced URL patterns such as
:foo+
and:digits(\d+)
can be supported.https://github.com/pillarjs/path-to-regexp#compile-reverse-path-to-regexp