- About
- Versions
- Installation
- MySQL branch(master)
- Mongo branch
- Running the app
- Swagger Endpoints
- Steps to create base project
- Util links
Project based in nest, basic crud in order to learn about:
- How to connect to DDBB SQL (MySQL -> typeorm)
- No-SQL (Mongo -> mongoose)
- HTTP Module (consume apis)
- Mem Cache
- Redis Cache
- Login (JWT)
- Endpoints with api-key
- Swagger
| Node | Nest | npm | yarn | Docker | Docker Compose |
|---|---|---|---|---|---|
| 16.2.0 | 7.6.0 | 7.12.0 | 1.22.10 | 20.10.6 | 1.29.1 |
$ npm install-
You need to check the configuration/credentials in ormconfig.json file
-
Make sure to have an MySQL instance running on the specified port (default 3306)
-
Generate an instance of Redis Cache running in the default Redis Port 6379
-
Create a DB with the name specified in the previous file named
-
Tip1: If you have a problems to read the entities, when you are starting the repo, or when you call some endpoint run:
$ npm run build -
Here you have a basic tutorial of how to install, run and create MySQL DB on Linux
-
Make sure to have an Mongo DB instance running on the specified port
-
Check the app.module.ts file, on import you can see MongooseModule and their specific configurations
-
Generate an instance of Redis Cache running in the default Redis Port 6379
-
Here you have a basic tutorial of how to install Mongo DB on linux
# Step 0
$ npm i
# Step 0 bis
$ npm run build
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod# Install Nest Cli (Project generator of Nest)
$ npm i -g @nestjs/cli
# Creates Nest project
$ nest new 'project-name'
# Transpiles code to Js
$ npm run build
# Create a new controller named "task"
$ nest generate controller tasks
# Create a new Service named "task"
$ nest generate service tasks
# Create a new Module named "task"
$ nest generate module tasks
You can see in the root of the project are: app.module, app.service, app.controller. Those are the mains.
Official Nest js Documentation
From here I learnt to make PUT in mongo and throw 404 exception
Express Js beginner course
From here I learnt MySql TypeOrm
How To apply Swagger in your node project (basic)
How To apply Swagger in your node project (intermediate)
How to apply Cookies in nest official doc
Decode and Encode tokens here
JWT LOGIN HASH implemented as Observable way (I migrated this solution to Promise way)