In the zod-middleware documentation, an example is provided:
export async function endpointCode(req: TypedRequestBody<typeof bodySchema>, res: Response) {
const typedBody = req.body;
return res.json(typedBody);
}
This example demonstrates accessing the body through req.body
. However, I also need access to both QUERY and PARAMS. While my current router setup looks like this:
exampleRouter.get("/:id/examples", processRequest({ params: FindExamplesParams, query: FindExamplesQuery }), findExamples);
I am unsure of how to declare the findExamples
function to access both query and params simultaneously.
It's straightforward for just query or just params:
export async function findSomething(req: TypedRequestQuery<typeof SomeQuery>, res: ...)
But how can I achieve access to both?