TsRestApi and route registration
View as MarkdownIdentity
Section titled “Identity”initContract and TsRestApi exported from @sapporta/server.
Contract
Section titled “Contract”initContract()creates ts-rest query and mutation contracts.new TsRestApi<Env>()creates a Hono-compatible contract registry.register(routeId, route, handler)supplies parsedrequestand Hono contextc.- Handlers return a response declared by the route as
{ status, body }or a supported raw response. - Project route modules are mounted explicitly from
loadApp(); mounting under/apiadds the public prefix.
Minimal lookup
Section titled “Minimal lookup”import { initContract, TsRestApi } from "@sapporta/server";