NestJs in Practice (with MongoDB)
NestJs 在实践中(使用 MongoDB)
这就像 Angular,但用于后端!使用 Typescript 和熟悉的 Angular API 构建现代 REST 后端
教程演示🔗
更多前端开发教程
Dive deep into the application of the Nest Framework in practice with this course, coupled with Mongo Database to build modern RESTful services. You will learn how to leverage TypeScript and Angular API for modular development, creating robust modules, controllers, and services. The course covers everything from Object Document Mapping to Role Access Control, User Authentication, and Fault Tolerance Handling among other modern backend technologies. Whether it’s hands-on programming or backend debugging, this course provides comprehensive guidance and knowledge for your backend development journey, ensuring you’re adept in Create-Read-Update-Delete data manipulation and securing your APIs.
通过本课程,深入探索 Nest 框架在实践中的应用,并结合蒙戈数据库构建现代RESTful服务。您将学习如何利用 TypeScript 和 Angular API,实现模块化开发,创建稳健的模块、控制器和服务。课程内容涵盖了从对象文档映射到角色访问控制、用户身份验证以及容错处理等现代后端技术。无论是实战编程还是后端调试,本课程将为您的后端开发之旅提供全面的指导和知识,助您精通增删改查的数据操作,并确保您的API安全可靠。
What you’ll learn 学习内容
-
Code in Github repository with downloadable ZIP files per section
Github 存储库中的代码,每个部分包含可下载的 ZIP 文件 -
NestJs Deep Dive – Modules, Controllers, Services, Pipes, Middleware, Guards, etc.
NestJs 深入探讨 – 模块、控制器、服务、管道、中间件、防护装置等 -
NestJs Design Patterns – Controllers and Repositories
NestJs 设计模式 – 控制器和存储库 -
Complete NestJs / MongoDB CRUD example
完整的 NestJs / MongoDB CRUD 示例 -
Mongoose ODM (Object to Document Mapping) library
Mongoose ODM(对象到文档映射)库 -
Introduction to MongoDB MongoDB 简介
-
Decorator-based Data Validation
基于装饰器的数据验证 -
Authentication in NestJs with JSON Web Tokens (JWT)
使用 JSON Web 令牌 (JWT) 在 NestJs 中进行身份验证 -
NestJs RBAC Authorization (Role-Based Access Control)
NestJs RBAC 授权(基于角色的访问控制)
Requirements 要求
-
No prior knowledge of NestJs or Angular is needed
无需 NestJs 或 Angular 的先验知识 -
Prior knowledge of Typescript is important
打字稿的先验知识很重要
Description 描述
This Course in a Nutshell
本课程简介
If you don’t know NestJs, it’s like Angular but for the backend. With it, we can write our backend using the same concepts and object-oriented APIs that we already use to structure our Angular frontend: components, services, modules, pipes, etc.
如果你不了解 NestJs,它就像 Angular,但用于后端。有了它,我们可以使用我们已经用来构建 Angular 前端的相同概念和面向对象的 API 来编写后端:组件、服务、模块、管道等。
NestJs is also quite similar to popular libraries that you might already be used to, such as, for example, the Spring library in the Java ecosystem, or ASP.NET MVC for the C# ecosystem.
NestJs 也与您可能已经习惯的流行库非常相似,例如 Java 生态系统中的 Spring 库,或者 C# 生态系统中的 ASP.NET MVC。
Course Overview 课程概述
In this course, you are going to learn from scratch how to design and develop a NestJs backend that will take the form of a REST API that queries a MongoDB database using the Mongoose ODM (Object Document Mapping) library. We will be providing a complete CRUD example showing how to perform the most common REST data retrieval and data modification operations using NestJs.
在本课程中,您将从头开始学习如何设计和开发 NestJs 后端,该后端将采用 REST API 的形式,该 API 使用 Mongoose ODM(对象文档映射)库查询 MongoDB 数据库。我们将提供一个完整的 CRUD 示例,展示如何使用 NestJs 执行最常见的 REST 数据检索和数据修改操作。
No prior NestJs, MongoDB or Mongoose knowledge is assumed as we will explain everything from scratch. We will cover all the essential NestJs concepts such as Modules, Controllers and injectable services.
不假设事先了解 NestJs、MongoDB 或 Mongoose,因为我们将从头开始解释所有内容。我们将涵盖所有基本的 NestJs 概念,例如模块、控制器和可注入服务。
We will learn in detail how to validate business data using a decorator based approach (with decorators like @IsString(), @IsPhoneNumber(), etc.) by leveraging the built-in NestJs Validation pipe.
我们将详细了解如何利用内置的 NestJs 验证管道,使用基于装饰器的方法(使用 @IsString()、@IsPhoneNumber() 等装饰器)验证业务数据。
We will also implement using NestJs commonly needed backend security functionality such as User Authentication, RBAC (Role-Based Access Control) Authorization, error handling, and cover more advanced NestJs concepts such as Filters, Pipes, Guards, interceptors and middleware.
我们还将实现使用 NestJs 常用的后端安全功能,例如用户身份验证、RBAC(基于角色的访问控制)授权、错误处理,并涵盖更高级的 NestJs 概念,例如过滤器、管道、防护、拦截器和中间件。
Table of Contents 目录
This course covers the following topics:
本课程涵盖以下主题:
-
Introduction to NestJs NestJs 简介
-
Running NestJs in Hot Reload and Debug mode
在热重载和调试模式下运行 NestJs -
Writing our first NestJs REST endpoint
编写我们的第一个 NestJs REST 端点 -
NestJs Modules, Controllers and injectable Services
NestJs 模块、控制器和注射服务 -
Introduction to MongoDB MongoDB 简介
-
Setting up a cloud MongoDB database
设置云 MongoDB 数据库 -
Introduction to the Mongoose ODM library
Mongoose ODM 库简介 -
Querying MongoDB from a NestJs REST endpoint
从 NestJs REST 端点查询 MongoDB -
Complete CRUD example with NestJs and MongoDB
使用 NestJs 和 MongoDB 的完整 CRUD 示例 -
NestJs Filters and custom error handling
NestJs 过滤器和自定义错误处理 -
NestJs Pipes, building a custom pipe
NestJs 管道,构建自定义管道 -
Data Validation with class-validator and the Validation pipe
使用 class-validator 和 Validation 管道进行数据验证 -
NestJs Middleware NestJs 中间件
-
User Authentication with NestJs
使用 NestJs 进行用户身份验证 -
NestJs RBAC (Role-Based Access Control) Authorization
NestJs RBAC(基于角色的访问控制)授权 -
NestJs Guards NestJs 守卫
What Will You Learn In this Course?
您将在本课程中学到什么?
After taking this course, you will feel comfortable designing and developing applications using NestJs. You will have learned everything that you need to know in practice for designing and developing production-ready secure backends using the NestJs framework.
完成本课程后,您将能够轻松地使用 NestJs 设计和开发应用程序。您将在实践中学习使用 NestJs 框架设计和开发生产就绪型安全后端所需的所有知识。
Who this course is for:
本课程适用于谁:
- Web Developers in general, looking for a detailed guide to the NestJs framework
一般的 Web 开发人员,正在寻找 NestJs 框架的详细指南 - Angular Developers, looking to reuse some of the same Angular concepts and apply them to the backend as well
Angular 开发人员,希望重用一些相同的 Angular 概念并将它们应用到后端