serverless-lambda-nestjs
v0.0.2
Published
Simple wrapper for Nestjs to run in AWS Lambda
Downloads
28
Readme
Serverless AWS Lambda Nestjs Adapter
Badges
Usage
Add it into your Nestjs with AWS Lambda application
$ npm install -S serverless-lambda-nestjsWrap your Nestjs application by the package.
import { APIGatewayProxyHandler } from 'aws-lambda';
import { ServerlessNestjsApplicationFactory } from 'serverless-lambda-nestjs';
// YOUR Nestjs application root module
import { AppModule } from './app.module';
export const handler: APIGatewayProxyHandler = async (event, context) => {
const app = new ServerlessNestjsApplicationFactory<AppModule>(
AppModule,
);
const result = await app.run(event, context);
return result;
};
export const handler: APIGatewayProxyHandler = async (event, context) => {
const app = new ServerlessNestjsApplicationFactory<AppModule>(
AppModule,
{
// NestFactory.create's option object
cors: true,
},
app => {
// Call additional API from NestFactory.create result
app.enableCors();
return app;
},
);
const result = await app.run(event, context);
return result;
};OGP
// both
$ yarn run create:ogp
// dark
$ yarn run create:ogp:dark
// light
$ yarn run create:ogp:light

Prepare
$ git clone [email protected]:hideokamoto/serverless-lambda-nestjs.git
$ cd serverless-lambda-nestjs
// Put your GitHub Personal Access Token
$ mv .envrc.example .envrc
$ vim .envrc
export CONVENTIONAL_GITHUB_RELEASER_TOKEN=PUT_YOUR_GITHUB_ACCESS_TOKEN
// Install
$ yarn
or
$ npm installGitHub Personal Access Token Scope
If the project is private -> repo
If the project is public -> public_repo
Commit message rule
The repository runs commitlint. We have to follow "Conventional Commit" to make a commit message.
https://www.conventionalcommits.org/en/v1.0.0-beta.4/
$ git commit -m "<type>[optional scope]: <description>
[optional body]
[optional footer]"Contribution
// clone
$ git clone [email protected]:hideokamoto/serverless-lambda-nestjs.git
$ cd serverless-lambda-nestjs
// setup
$ yarn
// Unit test
$ yarn test
or
$ yarn run test:watch
// Lint
$ yarn run lint
or
$ yarn run lint --fix
// Build
$ yarn run build
// Rebuild docs
$ yarn run doc
