1.1.1-rc1 • Published 4 years ago

@gcoreplus/nestjs-aws-serverless v1.1.1-rc1

Weekly downloads
65
License
ISC
Repository
github
Last release
4 years ago

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

NameDescription
engineEngine name to be use express or fastify. Default value express
warmup.sourceCheck for aws event source (context.source === warmup.source), if equal it will return string Lambda is warm!. See serverless-plugin-warmup
fastify.optionsFastify options. See options
fastify.binaryTypesList of binaries for Fastify. See aws-lambda-fastify
nestjs.optionsNestJs application options. See NestApplicationOptions
nestjs.onBeforeInitFunction called before the app.init() is invoked
nestjs.onAfterInitFunction called after the app.init() is invoked

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

License

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

Acknowledgements

Copyright © 2020 gCorePlus Inc.

1.1.0-rc1

4 years ago

1.1.1-rc1

4 years ago

1.1.0

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.9

4 years ago

1.0.10

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago