T
TanStack4mo ago
extended-salmon

query params

How can i access query params in api routes? Only path params are documented
2 Replies
environmental-rose
environmental-rose4mo 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
constant-blue
constant-blue4mo ago
exactly for API routes you need to handle it yourself like that

Did you find this page helpful?