T
TanStack7mo ago
like-gold

query params

How can i access query params in api routes? Only path params are documented
2 Replies
dependent-tan
dependent-tan7mo ago
I think that TSS does not have something specific for search params, but you could use the request object
const url = new URL(request.url);
const searchParams = url.searchParams;
const url = new URL(request.url);
const searchParams = url.searchParams;
and validate with zod or valibot if you want
fascinating-indigo
fascinating-indigo7mo ago
exactly for API routes you need to handle it yourself like that

Did you find this page helpful?