Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kop7/serverless-nestjs-typeorm
Example how to nestjs using the serverless framework with TypeORM
https://github.com/kop7/serverless-nestjs-typeorm
aws-lambda crud mysql nestjs nestjs-backend serverless serverless-framework typeorm typescript
Last synced: 26 days ago
JSON representation
Example how to nestjs using the serverless framework with TypeORM
- Host: GitHub
- URL: https://github.com/kop7/serverless-nestjs-typeorm
- Owner: kop7
- Created: 2019-10-17T12:47:11.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-17T10:24:22.000Z (about 1 year ago)
- Last Synced: 2024-08-03T16:08:23.767Z (4 months ago)
- Topics: aws-lambda, crud, mysql, nestjs, nestjs-backend, serverless, serverless-framework, typeorm, typescript
- Language: TypeScript
- Homepage: https://dev.to/kop7/how-to-use-serverless-with-nestjs-2peg
- Size: 9.77 KB
- Stars: 115
- Watchers: 4
- Forks: 14
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-nestjs - Serverless NestJS TypeOrm - Example how to NestJS using the serverless framework with TypeORM. (Resources)
README
# serverless-nestJS-typeORM-crud
##### This is example how to nestjs using the serverless framework
- TypeORM
- MySql
- CRUD
## setup mysql connection in serverless.yml
```
# Custom Variables
custom:
...
mysqlHost:
local: localhost
mysqlUser:
local: user
mysqlPassword:
local: password
mysqlDatabase:
local: dbname
mysqlPort:
local: '3306'
```
## How to prepare
```
$ npm install serverless -g
$ git clone https://github.com/kop7/serverless-nestjs-typeorm.git 【projectName】
$ cd 【projectName】
$ npm install
```## Development
```
$ npm run sls:offline
Serverless: Typescript compiled.
Serverless: Watching typescript files...
Serverless: Starting Offline: undefined/undefined.Serverless: Routes for author:
Serverless: ANY /api/authorServerless: Routes for book:
Serverless: ANY /api/bookServerless: Offline listening on http://localhost:3000
```The logs should be :
```
Serverless: ANY /api/book (λ: book)
[Nest] 7980 - 09/02/2019, 6:33:47 PM [NestFactory] Starting Nest application...
[Nest] 7980 - 09/02/2019, 6:33:47 PM [InstanceLoader] TypeOrmModule dependencies initialized +34ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [InstanceLoader] AppModule dependencies initialized +43ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [InstanceLoader] ConfigModule dependencies initialized +5ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [InstanceLoader] TypeOrmCoreModule dependencies initialized +168ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [InstanceLoader] TypeOrmModule dependencies initialized +1ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [InstanceLoader] TypeOrmModule dependencies initialized +0ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [InstanceLoader] BookModule dependencies initialized +3ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [InstanceLoader] AuthorModule dependencies initialized +0ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [RoutesResolver] AppController {/}: +10ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [RoutesResolver] BookController {/api/book}: +1ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [RouterExplorer] Mapped {/, GET} route +6ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [RouterExplorer] Mapped {/:id, GET} route +3ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [RouterExplorer] Mapped {/, POST} route +2ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [RouterExplorer] Mapped {/bulk, POST} route +4ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [RouterExplorer] Mapped {/:id, PATCH} route +4ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [RouterExplorer] Mapped {/:id, PUT} route +2ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [RouterExplorer] Mapped {/:id, DELETE} route +2ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [RoutesResolver] AuthorController {/api/author}: +1ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [RouterExplorer] Mapped {/, GET} route +2ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [RouterExplorer] Mapped {/:id, GET} route +2ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [RouterExplorer] Mapped {/, POST} route +3ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [RouterExplorer] Mapped {/bulk, POST} route +2ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [RouterExplorer] Mapped {/:id, PATCH} route +2ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [RouterExplorer] Mapped {/:id, PUT} route +2ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [RouterExplorer] Mapped {/:id, DELETE} route +2ms
[Nest] 7980 - 09/02/2019, 6:33:47 PM [NestApplication] Nest application successfully started +6ms
```[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/mkop)