Open digitex opened 1 week ago
For Next.js with App Router, any unimplemented methods will return 404 instead of 405:
Taking example from https://github.com/ts-rest/ts-rest/blob/main/apps/example-next/
import { initContract } from '@ts-rest/core'; import { z } from 'zod'; const c = initContract(); export const testContract = c.router( { test: { method: 'GET', path: '/test/:id', pathParams: z.object({ id: z.coerce.number(), }), query: z.object({ foo: z.string(), bar: z.number(), }), responses: { 200: z.object({ id: z.number(), foo: z.string(), bar: z.number(), }), }, }, }, { strictStatusCodes: true, }, );
POST request to /test/:id will return HTTP 404:
{ "message": "Not Found" }
For Next.js with App Router, any unimplemented methods will return 404 instead of 405:
Taking example from https://github.com/ts-rest/ts-rest/blob/main/apps/example-next/
POST request to /test/:id will return HTTP 404: