HTTP
The HTTP arc on FlareHost - routes, middleware, contracts, state, CORS, and error handlers.
AI generated, pending review
host.http is Flare’s HTTP arc: the registration surface for routes, middleware, request state, contracts, CORS, and error handlers. You compose everything on the host, then call host.build() to validate the graph and compile per-route pipelines. Until build() runs, inbound requests get a 503 with a not-ready JSON body.
For why transport lives on an arc while services and config stay on the host, see The arc model. For the full registration table on FlareHost, see Host.
Foundations
Section titled “Foundations”- Authoring styles: Inline functions versus controller classes, and when to pick each.
- Routing: Register paths, groups, controllers, and understand matcher behavior.
- Middleware: before, after, and finally hooks that wrap route handlers.
Requests in and out
Section titled “Requests in and out”- Contracts and validation: Typed route, query, and body descriptors validated at the edge.
- Requests: FlareRequest, ctx.req fields, and body readers.
- Responses: Handler return types, FlareResponse, and response normalization.
- CORS: Arc-wide and per-group CORS policies with automatic preflight.
State and failure
Section titled “State and failure”- Request state: Typed per-request tokens written by middleware, with build-time provisioning checks.
- Error handling: Map thrown errors to HTTP responses with host.http.error.