Miss any of our Open RFC calls?Watch the recordings here! »

@gcoreplus/nestjs-aws-serverless

1.0.12 • Public • Published

npm version Codecov Coverage ISC license

Nestjs AWS Serverless

About

@gCorePlus/nestjs-aws-serverless provide easy way to run Nest.js on AWS Lambda using express or fastify engines

Inspired by the aws-serverless-express and aws-lambda-fastify library

👨🏻‍💻Installation

Install the main lib

npm install --save @gcoreplus/nestjs-aws-serverless

Install the libs for your favorite engine

Express
npm install --save @nestjs/platform-express
npm install --save aws-serverless-express
Fastify
npm install --save @nestjs/platform-fastify
npm install --save aws-serverless-fastify

Create the aws handler

Create a file (e.g. main-aws.ts) to boot your app on lambda

Express
import { lambda } from '@gcoreplus/nestjs-aws-serverless';
import { AppModule } from './app.module';
 
export const handler = lambda(AppModule);
Fastify
import { lambda } from '@gcoreplus/nestjs-aws-serverless';
import { AppModule } from './app.module';
 
export const handler = lambda(AppModule, {engine: 'fastify'});

Deploy

Deploy your app on AWS Lambda with serverless or setup manually pointing to main-aws.ts as main-aws.handler

see example from express or fastify

...
functions:
  hello-world:
    name: ${self:custom.prefix-name}
    handler: dist/test/nestjs-aws-serverless-express/src/main-aws.handler
...

Options

Name Description
engine Engine name to be use express or fastify. Default value express
warmup.source Check for aws event source (context.source === warmup.source), if equal it will return string Lambda is warm!. See serverless-plugin-warmup
fastify.options Fastify options. See options
fastify.binaryTypes List of binaries for Fastify. See aws-lambda-fastify

Examples

Check the examples for express and fastify and deploy using the follow commands

npm install
npm run build
npm run deploy:test:us-east-1

Backers

Rennan Stefan Boni

License

Distributed under the ISC License. See LICENSE for more information.

Acknowledgements

Copyright © 2020 gCorePlus Inc.

Install

npm i @gcoreplus/nestjs-aws-serverless

DownloadsWeekly Downloads

46

Version

1.0.12

License

ISC

Unpacked Size

14.8 kB

Total Files

6

Last publish

Collaborators

  • avatar