nextlove
nextlove copied to clipboard
An NPM module that has best practices and essential modules for building APIs with NextJS
E.x. `nextlove generate-route-schemas` should output ```ts import {z} from "zod" const routes = { "/hello/world": { queryParams: z.object({device_id: z.string()}) jsonResponse: z.object({message: z.string()}) } } ```
Itd be nice to see what this produced via a test but looks okay to start! _Originally posted by @seveibar in https://github.com/seamapi/nextlove/pull/72#pullrequestreview-1434574424_
Close #60 Checks if json response is a zod json object schema or not by checking the zod schema definition typeName. It's a bit of a weird feature that I...
```typescript withRouteSpec({ methods: ["GET"], jsonResponse: z.array(z.number()) } as const) ``` doesn't work: 
`jsonResponse` type checking should be applied when `.status` is omitted since it defaults to 200: https://user-images.githubusercontent.com/7410405/230510123-1fa03cfc-54fc-414e-a059-6085baa87bad.mov
New Vercel App endpoints don't support `res` Could this also help with method-discriminated validation more generally? ```ts export const GET = withRouteSpec.get({ queryParams: z.object({ }) } as const, async (req)...