Closed balibintang closed 5 months ago
Thank you for using the library and thank you for this proposal.
I think producing any side effects, or modifying the control flow of a request (outside of validation failing) is strictly out of scope for this package. In my eyes, next-typesafe-url
's role at runtime is only to deserialize and validate the incoming search/route params.
However, I do understand your use case. My recommendation would be to explore something like whopio/next-app-middleware (likely other similar solutions out there as well), in conjunction with next-typesafe-url
's parseServerSideParams
Let me know if there is anything else I can help with
Not a problem,
Thanks for making your work public! That makes sense given the targeted scope of the project.
I just had a read through the linked package and a mixture of both does seem like a good solution, thanks for the recommendation.
Hey Ethan,
Love the project and the overall structure of it. We're currently using it for routing at our company but the overall structure of the package and the
RouteType.ts
files makes it near perfect for route based access control. I was wondering if you'd be open to me extending this with the following proposal:Proposal
RouteType.ts
file to also export a generic function that can be run when the route is hitRouteType.ts
intoRouteData.ts
_next-typesafe-url_.d.ts
that contains an object that maps the routes to these functionsWhy this project The work thats been setup in this project to watch the next directory structure as well as it being centralised in routing makes it an ideal candidate for this implementation.
Im happy to fork the project and work on it in isolation but was wondering if you'd be interested in having this within the project itself.