Skip to main content

Serverless Adapter

Run REST APIs and other web applications using your existing Node.js application framework (NestJS, Express, Koa, Hapi, Fastify and many others), on top of AWS, Azure, Digital Ocean and many other clouds.

Easy to Use & Extensible

The library was designed to be very extensible and easy to use.

One library, many Serverless environments

We currently support AWS, Azure, Firebase, Digital Ocean, Google Cloud Functions and Huawei.

Fully Typed & Tested

The entire library was written with typescript to give the developer the best experience and we have 100% coverage.

To start, first, install the library with:

npm i --save @h4ad/serverless-adapter

And then you can add support, for example, to AWS Api Gateway V2 and AWS SQS to your Express App with:

index.ts
import { ServerlessAdapter } from '@h4ad/serverless-adapter';
import { ApiGatewayV2Adapter, SQSAdapter } from '@h4ad/serverless-adapter/lib/adapters/aws';
import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express';
import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default';
import { PromiseResolver } from '@h4ad/serverless-adapter/lib/resolvers/promise';
import app from './app';

export const handler = ServerlessAdapter.new(app)
.setFramework(new ExpressFramework())
.setHandler(new DefaultHandler())
.setResolver(new PromiseResolver())
.addAdapter(new ApiGatewayV2Adapter())
.addAdapter(new SQSAdapter())
.build();