Search URL structuring
Hi guys, I have a dynamic URL in Next:
search/[word]/[[...rest]]
and I was wondering how would I parse this best?
I don't want to build the URL out directly, I want to keep it somewhat dynamic so I can do something like this: /search/Hello T3/tags/typescript|next/length/1-10
and structure it any way I like and leave stuff out I don't need.
My code currently is this, but I feel like this is super stupid:
1 Reply
https://github.com/ethanniser/next-typesafe-url/tree/appdir
this is my own package for working with search + route params in next
im shipping version 2.0 later today, but the docs are up right now
does this look like it would solve your issue?
GitHub
GitHub - ethanniser/next-typesafe-url at appdir
JSON serializable, fully typesafe, and zod validated URL search params, dynamic route params, and routing for NextJS pages directory - GitHub - ethanniser/next-typesafe-url at appdir