Skip to main content
CF

NestJs - Build Modern APIs in NestJs with Unit Testing

9h 19m 27s
English
Paid

You will learn how to build clear and safe APIs with NestJS. You will also learn how to write unit tests that help you trust your code.

What You Learn

NestJS is a Node.js framework that helps you build server apps with clean structure. You use TypeScript, so you catch errors early and keep code easy to read.

You work with common NestJS features such as controllers, services, and modules. You also learn how to write tests that check each part of your app.

Why Use NestJS

NestJS gives you tools for routing, database access, and testing. You can connect to SQL or NoSQL databases with simple code. The framework guides you toward clear and strong design.

Apps built with NestJS are easy to test and maintain. The code stays organized because parts of the app do not depend too much on each other.

How This Course Helps You

You build the API step by step. You write tests as you go. This helps you understand how each piece works and why it matters.

By the end, you know how to build and test real APIs with NestJS and TypeScript.

About the Author: Udemy

Udemy thumbnail

Udemy is the largest open marketplace for online courses on the internet. Founded in 2010 by Eren Bali, Oktay Caglar, and Gagan Biyani and headquartered in San Francisco, the company went public on the Nasdaq in 2021 under the ticker UDMY. The platform hosts well over two hundred thousand courses across software development, IT and cloud, data science, design, business, marketing, and creative skills, taught by tens of thousands of independent instructors. Roughly seventy million learners use it worldwide, and the corporate arm — Udemy Business — supplies a curated subset of that catalog to enterprise customers.

Because Udemy is a marketplace rather than a single editorial publisher, the catalog is uneven by design. The strongest material lives in the long-form, project-based courses authored by working engineers — full-stack JavaScript, React, Node.js, Python data science, AWS, Docker and Kubernetes, mobile development with Flutter and React Native, and cloud certification preparation. The CourseFlix listing under this source is the slice of that catalog that has been mirrored here for offline-friendly viewing, organized by topic and updated as new releases land. Pricing on Udemy itself swings dramatically with the site's near-permanent sales, which is why the platform is best treated as a deep reference catalog: pick instructors with strong reviews and a track record of updating their material rather than buying on the headline price alone.

Watch Online 100 lessons

This is a demo lesson (10:00 remaining)

You can watch up to 10 minutes for free. Subscribe to unlock all 100 lessons in this course and access 10,000+ hours of premium content across all courses.

View Pricing
0:00
/
#1: Introduction to the Course
All Course Lessons (100)
#Lesson TitleDurationAccess
1
Introduction to the Course Demo
01:33
2
DEMO of API
05:47
3
What is Nest.js & Why we need it?
02:51
4
How to Follow the Course & Code?
01:55
5
Installing all required tools
02:54
6
Install MongoDB on MacOS
02:00
7
Install MongoDB on Windows
04:26
8
Installing Nest CLI & Creating app
03:15
9
Understanding the folder structure
03:07
10
Nest.js Modules
04:45
11
Nest.js Controllers
03:43
12
Nest.js Service & Providers
05:33
13
Connecting to MongoDB with mongoose
10:08
14
Creating Restaurant Schema
08:23
15
Get all Restaurants
11:10
16
Create a new Restaurant
06:23
17
What is DTO?
02:24
18
Creating a Restaurant DTO
02:33
19
Get Restaurant by ID
06:53
20
Update Restaurant by ID
08:10
21
Delete Restaurant
04:48
22
Adding Search
06:55
23
Adding Pagination
05:10
24
What are Pipes?
03:30
25
Using Validation Pipe Globally
10:37
26
Adding Validation Rules in Update DTO
03:35
27
Invalid Mongoose ID Error
03:00
28
What is GeoCoder
03:04
29
Generating Coordinates & Address
10:24
30
Saving Location in Restaurants
05:48
31
Create Bucket on S3
07:54
32
Getting files through File Intercepter
06:51
33
Uploading images to S3
11:56
34
Saving Images in Restaurant
03:16
35
Delete Restaurant Images
09:51
36
Generating Auth Module
02:55
37
Creating User Schema
05:54
38
Sign up DTO with Validators
02:24
39
User Sign up
06:41
40
Hash user password while Sign up
03:32
41
Handle Duplicate Email Error
02:46
42
Login User
07:36
43
Setting Up JWT & Passport
06:04
44
Sign JWT token on Login
05:49
45
Setting Up JWT Strategy
08:23
46
Using AuthGuard to Protect Routes
04:44
47
Current User Decorator
04:55
48
Saving Current User in Restaurant
05:53
49
Creating User Roles Guard
08:19
50
Roles Decorator
03:50
51
Authorize Restaurant Ownership
05:16
52
Creating Meal Model
05:54
53
Create Meal DTO
06:11
54
Creating a Meal
14:49
55
Getting all Meals
05:25
56
Get Meal by ID
03:52
57
Update Meal
06:58
58
Delete Meal
05:55
59
Create Library Project
04:26
60
Install & Setup Postgres & pgAdmin
03:37
61
Connecting to Postgres Database
04:09
62
Create Book Entity
03:14
63
Create new Book
08:12
64
Get all Books & Book by ID
03:59
65
Update Book
04:10
66
Delete Book
02:25
67
Relations & Types of relations
02:42
68
Create User Entity
05:34
69
Adding Books & User Relation (OneToMany & ManyToOne)
06:49
70
What is Unit Testing?
02:48
71
Write first unit test in Restaurant Service
08:40
72
Testing RestaurantsService - findAll
10:23
73
Testing RestaurantsService - create
09:49
74
Testing RestaurantsService - findById
08:44
75
Testing RestaurantsService - updateById
04:47
76
Testing RestaurantsService - deleteById
02:34
77
Testing RestaurantsService - uploadImages
05:50
78
Testing RestaurantsService - deleteImages
02:47
79
First unit test in Restaurant Controller
06:51
80
Testing RestaurantController - getAllRestaurants
03:43
81
Testing RestaurantController - createRestaurant
03:42
82
Testing RestaurantController - getRestaurantById
03:06
83
Testing RestaurantController - updateRestaurant
09:15
84
Testing RestaurantController - deleteRestaurant
07:24
85
Testing RestaurantController - uploadFiles
03:53
86
Testing Auth Service
05:54
87
Testing AuthService - signUp
09:27
88
Testing AuthService - login
08:49
89
Testing Auth Controller
04:09
90
Testing AuthController - signUp
03:05
91
Testing AuthController - login
02:21
92
Testing JwtStrategy
11:28
93
What is e2e Testing
04:20
94
Testing Authentication Routes
10:48
95
Testing Restaurants POST protected Routes
06:08
96
Testing Restaurants GET Routes
04:10
97
Testing Restaurants PUT & DELETE Routes
02:28
98
Preparing API for Deploy
07:27
99
Deploy API on Heroku
05:57
100
Congratulations!!!
00:46
Unlock unlimited learning

Get instant access to all 99 lessons in this course, plus thousands of other premium courses. One subscription, unlimited knowledge.

Learn more about subscription

Related courses

Frequently asked questions

What are the prerequisites for enrolling in this NestJS course?
The course is designed for developers who have a basic understanding of JavaScript and some experience with Node.js. Familiarity with TypeScript is also recommended, as the course involves building APIs using TypeScript. Additionally, having some knowledge of databases and RESTful APIs would be beneficial, although not strictly necessary.
What projects will I build during this course?
During the course, you will build a comprehensive API for managing restaurants and meals. This includes creating and managing restaurant entities, handling user authentication and authorization, and implementing image uploads to S3. You'll also learn to connect to databases using MongoDB and Postgres, and apply various features of NestJS like controllers, services, and modules.
Who is the target audience for this course?
This course is ideal for backend developers looking to enhance their skills in building modern APIs using NestJS. It caters to those who want to learn unit testing best practices and improve their code quality with TypeScript. It is also suitable for developers aiming to work with MongoDB and Postgres databases in a NestJS environment.
How does this course compare in depth and scope to other API development courses?
The course covers a wide range of NestJS features, including modules, controllers, and services, with a focus on building scalable and maintainable APIs. It also emphasizes writing unit tests to ensure code reliability. Compared to other courses, this one provides hands-on experience with both SQL and NoSQL databases and covers the integration of AWS services like S3 for image uploads, offering a comprehensive learning experience.
What specific tools and platforms are utilized in this course?
The course makes extensive use of NestJS, a Node.js framework, along with TypeScript for building APIs. It incorporates MongoDB for NoSQL database access and Postgres for SQL database operations. Other tools include Mongoose for MongoDB integration, JWT and Passport for authentication, and AWS S3 for image uploads. The course also uses pgAdmin for managing Postgres databases.
What topics are not covered in this course?
The course does not cover front-end development or client-side frameworks. It focuses solely on backend API development, testing, and database integration. Additionally, it does not delve into advanced database optimization techniques or microservices architectures, as the primary focus is on building and testing APIs with NestJS.
How much time should I expect to commit to this course?
The course consists of 100 lessons, and while the total runtime is not specified, completing the course could take several weeks depending on your pace. It is structured to allow you to build the API step-by-step, including writing unit tests. Allocating regular study sessions each week will help you absorb the material effectively and complete the projects successfully.