Host middleware and inbound HTTP
Adapter design. This page specifies the unpublished adapter. Run a request with Octokit and Effect.
Expose each upstream handler in the host calling convention it expects. Construction produces a host callback or handler. Provide an Effect bridge at invocation, using the caller’s runtime and scoped lifetime. Preserve native return values when adapting back to the host. Import each host’s modules only through its matching entry point.
| Upstream package | Factories and helpers |
|---|---|
octokit, @octokit/app |
createNodeMiddleware(app, options?) combines the enabled OAuth and webhook routes. |
@octokit/webhooks |
createNodeMiddleware and createWebMiddleware; preserve path, logging, timeout, and each factory’s fallthrough semantics. |
@octokit/oauth-app |
createNodeMiddleware, createWebWorkerHandler, createAWSLambdaAPIGatewayV2Handler, portable handleRequest, unknownRouteResponse, and sendNodeResponse. Preserve headers, cookies, body encoding, URL prefix, redirects and handled/unhandled result. |
Incoming streams are single-use. Verification must see the original body. Do not parse/re-encode it in an Effect HTTP route before calling upstream. Host integration must neither send a second response nor call next after a handled route. Bind a client-disconnect signal only where the host exposes one. Server startup, port binding, routing policy and a job queue belong to the application.
Check. Match/miss under a custom prefix, next called exactly once, Web Request/Response, Lambda v2 event/result, OAuth callback redirect, response already started, timeout and client disconnect. A Node-only dependency must be absent from a browser entry-point import. App middleware · OAuth exports · Webhook exports