T
TanStack4w ago
flat-fuchsia

Query params in server API route

I have this server route:
export const Route = createFileRoute("/api/auth/apple/")({
server: {
handlers: {
validateSearch: zodValidator(startParamsSchema),
GET: async () => { ... }
}
}
}
export const Route = createFileRoute("/api/auth/apple/")({
server: {
handlers: {
validateSearch: zodValidator(startParamsSchema),
GET: async () => { ... }
}
}
}
How can I access the validated search? Thanks
2 Replies
flat-fuchsia
flat-fuchsiaOP4w ago
Is this the best way?
const url = new URL(request.url);
const searchParams = fromPairs([...url.searchParams.entries()]);
const params = startParamsSchema.parse(searchParams);
const url = new URL(request.url);
const searchParams = fromPairs([...url.searchParams.entries()]);
const params = startParamsSchema.parse(searchParams);
xenophobic-harlequin
xenophobic-harlequin4w ago
validateSearch does not exist there we have a private API getValidatedQuery might become public ...

Did you find this page helpful?