Typed routes, any schema
Define REST handlers with request and response schemas. Works with Zod, Valibot, ArkType, or any Standard Schema library.
import { Api } from "semola/api";import { z } from "zod";const api = new Api();api.defineRoute({ path: "/hello/:name", method: "GET", request: { params: z.object({ name: z.string() }), }, response: { 200: z.object({ message: z.string() }), }, handler: async (c) => { return c.json(200, { message: `Hello, ${c.req.params.name}!`, }); },});api.serve(3000);