Skip to main content

Fundamentals

Start here to understand the core APIs you will use in everyday Routed applications.

  • Routing basics – define routes on the engine or routers, create groups, name routes, and configure fallbacks.

  • Response compression – enable gzip for eligible buffered responses and understand streaming boundaries.

  • HTTP/2 support – enable ALPN negotiation, understand fallback behaviour, and integrate with TLS deployments.

  • Server-Sent Events – stream events with ctx.sse, heartbeats, and reconnect-friendly IDs.

  • Graceful shutdown – drain in-flight requests and coordinate signal-driven shutdowns.

  • Middleware – apply middleware globally, per-group, or per-route, and use the built-in helpers.

  • Requests – read query params, JSON bodies, multipart data, and form submissions.

  • Responses – return JSON, HTML, streams, redirects, and file downloads.

  • HTTP semantics – negotiate representations, honour conditional requests, and serve automatic OPTIONS responses.

  • Context data – access configuration, request IDs, and per-request state.

  • Headers and cookies – inspect and mutate headers, work with cookies, and set security flags.

  • Validation and Data binding – validate input and map payloads to data structures.

  • Error handling – customize exception responses, error pages, and hook into global error handlers.

  • Structured logging – capture contextual logs per request and plug into your observability pipeline.

  • Observability – enable tracing, metrics, health checks, and error observers with centralised configuration.

  • OpenAPI facilities – understand strengths, tradeoffs, merge precedence, and common metadata gotchas.

  • Configuration – use EngineConfig and functional options to tailor routing, security, caching, and more.

  • CLI reference – scaffold projects, run the dev server, inspect routes/specs, and manage configuration helpers.

  • Contracts – plug in custom configuration stores, cache repositories, and distributed locks.