ServerlessAdapter

View as MarkdownOpen in Claude

ServerlessAdapter adapts a Hono application for deployment on AWS Lambda, Google Cloud Functions, Azure Functions, or CGI. It normalizes platform-specific events into standard Request objects, routes them through the Hono app, and returns platform-compatible responses.

1import { ServerlessAdapter } from '@signalwire/sdk';
2
3const adapter = new ServerlessAdapter('lambda');
4// or auto-detect from environment variables
5const autoAdapter = new ServerlessAdapter();

Constructor

platform
ServerlessPlatformDefaults to 'auto'

Target platform. Valid values: "lambda", "gcf", "azure", "cgi", "auto". When "auto", the platform is detected from environment variables.

Methods

Example

1import { ServerlessAdapter } from '@signalwire/sdk';
2
3// AWS Lambda deployment
4const adapter = new ServerlessAdapter('lambda');
5export const handler = (event: any) => adapter.handleRequest(app, event);