Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wpkyoto/serverless-lambda-nestjs
https://github.com/wpkyoto/serverless-lambda-nestjs
nestjs
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/wpkyoto/serverless-lambda-nestjs
- Owner: wpkyoto
- License: mit
- Created: 2020-02-27T16:21:57.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2025-01-03T01:37:31.000Z (12 days ago)
- Last Synced: 2025-01-12T13:13:18.007Z (2 days ago)
- Topics: nestjs
- Language: TypeScript
- Homepage: https://hideokamoto.github.io/serverless-lambda-nestjs/
- Size: 2.48 MB
- Stars: 21
- Watchers: 2
- Forks: 5
- Open Issues: 53
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Serverless AWS Lambda Nestjs Adapter
## Badges
[![NPM](https://nodei.co/npm/serverless-lambda-nestjs.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/serverless-lambda-nestjs/)
[![npm version](https://badge.fury.io/js/serverless-lambda-nestjs.svg)](https://badge.fury.io/js/serverless-lambda-nestjs)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Maintainability](https://api.codeclimate.com/v1/badges/c17851759423ce151b9e/maintainability)](https://codeclimate.com/github/hideokamoto/serverless-lambda-nestjs/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/c17851759423ce151b9e/test_coverage)](https://codeclimate.com/github/hideokamoto/serverless-lambda-nestjs/test_coverage)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fwpkyoto%2Fserverless-lambda-nestjs.svg?type=small)](https://app.fossa.com/projects/git%2Bgithub.com%2Fwpkyoto%2Fserverless-lambda-nestjs?ref=badge_small)## Usage
Add it into your Nestjs with AWS Lambda application
```bash
$ npm install -S serverless-lambda-nestjs
```Wrap your Nestjs application by the package.
```typescript
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,
);
const result = await app.run(event, context);
return result;
};export const handler: APIGatewayProxyHandler = async (event, context) => {
const app = new ServerlessNestjsApplicationFactory(
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
```bash
// both
$ yarn run create:ogp// dark
$ yarn run create:ogp:dark// light
$ yarn run create:ogp:light
```
![image](./ogp_dark.png)
![image](./ogp_light.png)## 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 install
```### GitHub 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/
```bash
$ git commit -m "[optional scope]:[optional body]
[optional footer]"
```## Contribution
```bash
// 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
```