NestJS Basic Concepts (V 10.X)
Main Building Blocks
- Controller - Handle incoming request
- Services - Handle business logic
- Modules - Group together everything
- Pipes - Validate incoming data
- Filters - Handle incoming errors
- Guards - Handle authentication
- Interceptors - Adding extra data to incoming request or to response
- Repositories - Handle data stored in DB
How to generate Nest project using Nest CLI?
First, need to install Nest CLI on computer,
npm install -g @nestjs/cli
Then, create a new project using nest new <project_name>
This will generate the boilerplate for the project
The entry point of the application is main.ts file. It is calling main AppModule,
3 files attached with the main.ts,
- app.module.ts - The entry point
- app.controller.ts
- app.service.ts
Rest of the modules should be included to the AppModule as bellow,
Comments
Post a Comment