Skip to content
This repository has been archived by the owner on Dec 30, 2023. It is now read-only.

Consider using path-to-regexp's compile function #16

Open
lydell opened this issue Jan 15, 2019 · 2 comments
Open

Consider using path-to-regexp's compile function #16

lydell opened this issue Jan 15, 2019 · 2 comments

Comments

@lydell
Copy link
Contributor

lydell commented Jan 15, 2019

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

@gvergnaud
Copy link
Owner

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 :)

@lydell
Copy link
Contributor Author

lydell commented Jan 17, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants