Closed majelbstoat closed 1 year ago
Sounds like a good idea! Could you send a PR with this and some docs for the readme?
Would you be up for (in a separate patch) supporting additional complexity like additional pluggable handlers for POST/PUT etc, so this was a uniform routing framework, which could also handle things like Passport routes? I'd really like to be able to define all the routes in one place, but that might be outside the scope of what you want for this project.
I'd love a generalised way to attach metadata to a route. For example:
such that I could then have a custom handler:
(Specific use-case is a cache for logged out users who will all see the same thing and which can be cached aggressively - like this: https://github.com/zeit/next.js/blob/canary/examples/ssr-caching/server.js#L48, but I suspect a generalised metadata approach will support other use-cases too.)