Learn how to install, create new project, run service, test, use cli tool...etc. on NestJS - DOCS
@nestjs/common
- The module.ts file is the entry point of each module. The controller.ts does the routing and some config. The service.ts "provide" the services(functionalities).
- 42 oAuth 2 authantication with(or without) passport.js package. 1. First request will give the code. 2. with the code received in query string, send seconde request to aquire the API token. 3. Use the API token to retrive the user profile.
- use nestjs/config to get the .env contents
This is a good tuto video:WDS - Learn Prisma In 60 Minutes
And of course: NestJS - DOCS - Prisma
? do we always need to do the migration manualy on local server before dockerizing the project ?
Need to handle prisma error corectly with PrismaClientExceptionFilter
Database.
- install
cache-manager @types/cache-manager
- add CacheModule from '@nestjs/common' into imports array
- inject the CACHE_MANAGER into the service we want to use.
constructor(@Inject(CACHE_MANAGER) private readonly cacheManager: Cache)
- install `cache-manager-redis-store @types/
- Put the settings inside
CacheModule.register({})
.
isGlobal: true,
store: redisStore,
host: 'redis',
port: 6379,
- Add redis service into docker-compose
some possible issues:
-
cache store type not assignable: (dabroek/node-cache-manager-redis-store#53) solution: dabroek/node-cache-manager-redis-store#53 (comment)
-
use "url" in store options.
Learn how to integrate swagger into NestJS here: NestJS - DOCS - OpenAPI
Using "socket.io" library.
NestJS - DOCS - Gateways
npx nest g gateway
Aquire an SSL certificate from ZeroSSL. Follow the instruction on the site.
Copy the .crt and .key files into docker containers.
Use 'fs' package to read the file and add httpsOptions into main.ts.
- add dependencies into "imports", and "providers" in the ".spec.ts" file.