Source: https://h2corn.monicz.dev/api/

# API reference

Use [`serve()`](https://h2corn.monicz.dev/api/server/#h2corn.serve "serve") with a [`Config`](https://h2corn.monicz.dev/api/config/#h2corn.Config "Config") for the standard server entrypoint, or [`Server`](https://h2corn.monicz.dev/api/server/#h2corn.Server "Server") to embed one worker in an existing event loop. Static type annotations and ASGI message contracts live in `h2corn.types`, and closed-stream send failures raise [`SendAfterCloseError`](https://h2corn.monicz.dev/api/server/#h2corn.SendAfterCloseError "SendAfterCloseError").

| Page | Use it for |
| --- | --- |
| [Server entrypoints](https://h2corn.monicz.dev/api/server/) | Start a standalone server, embed one in an event loop, or catch `SendAfterCloseError`. |
| [Configuration types](https://h2corn.monicz.dev/api/config/) | Construct `Config`, `RequestPolicy`, and option literal types in `h2corn.types`. |
| [ASGI applications and aliases](https://h2corn.monicz.dev/api/applications/) | Annotate applications, factories, and send/receive callables from `h2corn.types`. |
| [Scopes and extensions](https://h2corn.monicz.dev/api/scopes/) | Work with headers, state, protocol versions, and extension metadata. |
| [HTTP scope and messages](https://h2corn.monicz.dev/api/http/) | Handle requests, responses, trailers, and file sending. |
| [WebSocket scope and messages](https://h2corn.monicz.dev/api/websockets/) | Accept connections, exchange messages, and close sessions. |
| [Lifespan scope and messages](https://h2corn.monicz.dev/api/lifespan/) | Handle application startup and shutdown. |

For per-option descriptions, defaults, environment variables, and CLI flags, see the [Configuration reference](https://h2corn.monicz.dev/configuration/#option-index).
