> This page is for Server SDKs.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# createCgiHandler

> Create a CGI handler that serves one request from a Hono app.

Static method that creates a CGI handler from a Hono app. Each call of the returned function
performs one CGI request/response cycle: it reads the request from the CGI environment and
standard input, routes it through the app, and writes the CGI response (status line, headers, a
blank line, then the body) to standard output.

## Parameters

**`app`** `{ fetch: (req: Request, env?: Record<string, unknown>) => Response | Promise<Response> }` — required

A Hono-compatible application with a `fetch` method.

---

## Returns

`() => Promise<void>` -- A function that handles one CGI request.

## Example

```typescript {6-7}
import { AgentBase, ServerlessAdapter } from '@signalwire/sdk';

const agent = new AgentBase({ name: 'dispatch', route: '/dispatch' });
agent.setPromptText('You are Ada, the dispatcher for Bayview Taxi.');

const handle = ServerlessAdapter.createCgiHandler(agent.getApp());
await handle();
```