> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# asRouter

> Get the underlying Hono app (Python-compat alias for getApp).

[ref-serve]: /docs/server-sdks/reference/typescript/agents/swml-service/serve

[ref-run]: /docs/server-sdks/reference/typescript/agents/swml-service/run

[ref-getapp]: /docs/server-sdks/reference/typescript/agents/swml-service/get-app

[ref-agentserver]: /docs/server-sdks/reference/typescript/agents/agent-server

Return the underlying [`Hono`](https://hono.dev) app for this service. This is
a Python-compat alias for [`getApp()`][ref-getapp] -- use either name
interchangeably. Pick `asRouter()` when porting code from the Python SDK that
called `as_router()` for a FastAPI `APIRouter`.

Use this to mount the service into an existing Hono application rather than
running a standalone server with [`run()`][ref-run] or
[`serve()`][ref-serve].

<Tip>
  Use `asRouter()` for production deployments where you want to control the
  HTTP server lifecycle, or when hosting multiple services on the same Hono
  instance via [`AgentServer`][ref-agentserver].
</Tip>

## **Returns**

`Hono` -- the configured Hono app with all routes registered (SWML document
endpoint plus any routing-callback paths).

## **Example**

```typescript {11}
import { Hono } from 'hono';
import { serve } from '@hono/node-server';
import { SWMLService } from '@signalwire/sdk';

const app = new Hono();

const service = new SWMLService({ name: 'ivr', route: '/ivr' });
service.addVerb('answer', {});
service.addVerb('play', { url: 'https://example.com/welcome.mp3' });

app.route('/ivr', service.asRouter());

serve({ fetch: app.fetch, port: 3000 });
```