ts-rest Has a Free API That Most Developers Dont Know About
typescript
dev.to
ts-rest creates type-safe REST APIs with a shared contract between client and server. Like tRPC but for REST endpoints. Define Contract import { initContract } from "@ts-rest/core"; import { z } from "zod"; const c = initContract(); export const contract = c.router({ getPost: { method: "GET", path: "/posts/:id", responses: { 200: z.object({ id: z.string(), title: z.string() }) } }, createPost: { method: "POST", path: "/posts", body: z.object({ title: z.string() }), responses