Examples
Short patterns live in Recipes - pick a scenario and copy the full snippets.
The guides explain each feature in depth. For copy-paste, end-to-end setups, use the Recipes section:
- REST API + typed client - CRUD,
AppRouter,import.meta.main - Auth with JsonToken - public login before
.use(), then protected routes - CORS for a SPA - origin whitelist, credentials, custom headers
- File uploads - multipart,
z.file(), save to disk - Errors & notFound - validation 400,
onError,HttpClientError - Behind a reverse proxy -
trustProxy,req.ip - Testing without a port -
server.fetch