Day 1 of our NestJS learning path covers the basics of modules, controllers, providers, and dependency injection. The hands-on part starts with installing the Nest CLI.
What is NestJS and Why Use It?
NestJS is a Node.js framework for building server-side applications. It is built with and fully supports TypeScript, while still letting you work with JavaScript. Key reasons to use NestJS include:
- Modular Architecture: Organize your code into modules for better scalability and maintainability.
- Dependency Injection (DI): Use dependency injection for the services or providers your code requires.
- Built-in Support for REST APIs: You declare RESTful endpoints with decorators, and the syntax stays clean.
- Extensible: It integrates with other libraries and frameworks, and microservices are supported too.
Key Topics for Day 1
- NestJS Overview: Understand the philosophy and benefits of using NestJS.
- Modules, Controllers, and Providers: Learn how these building blocks work together.
- Dependency Injection (DI): See how NestJS manages dependencies to keep your code modular and testable.
- Project Setup: Install the Nest CLI.
Hands-On: Setting Up the Project
Start by installing the NestJS CLI.
Steps to Create Your NestJS Project
-
Install the NestJS CLI (if not already installed):
npm install -g @nestjs/cli