createHttpHandler
function createHttpHandler(protocol, options?): (request) => Response | Promise<Response>;Defined in: src/http/handler.ts:105
Create a fetch-compatible HTTP handler for a vgi-rpc Protocol.
Compatible with Bun.serve(), Deno.serve(), Cloudflare Workers, and any Web API runtime that uses the standard Request/Response types.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
protocol | Protocol |
options? | HttpHandlerOptions |
Returns
Section titled “Returns”(request) => Response | Promise<Response>
Example
Section titled “Example”const handler = createHttpHandler(protocol);Bun.serve({ port: 8080, fetch: handler });