From the course: Mastering Nest.js: Build Scalable Applications with Mastery in Nest.js Framework
Unlock this course with a free trial
Join today to access over 25,200 courses taught by industry experts.
Controller fundamentals (@Post handler) - Nest.js Tutorial
From the course: Mastering Nest.js: Build Scalable Applications with Mastery in Nest.js Framework
Controller fundamentals (@Post handler)
As we are moving towards learning how to create basic APIs with NestJS, in this lecture, we are going to learn about the post handler with Nest. So in the products controller, we are going to create a new method. Let's name it as add products. And as this method will handle the incoming post requests, we have to specify the post decorator above the method. Let me give at post that is the post decorator. So, now the add products method is marked with the post handler. In this method, we are going to define the functionality to store the products. Right now, as we are not using any database, we are just going to store the products in an array, though we will see how to deal with the database in later sections. Now instead of giving the functionality of inserting a new product here in the method, we are going to distribute the code and define the functionality in a separate file, because in that way we can make the code more manageable. I'm going to create a separate service file or we…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
(Locked)
Understanding controllers5m 10s
-
(Locked)
Controller fundamentals (@Get handler)4m 21s
-
(Locked)
Controller fundamentals (Headers)3m 35s
-
(Locked)
Controller fundamentals (@Post handler)8m 57s
-
(Locked)
Controller fundamentals (@Post handler), part 2 with modules6m 56s
-
(Locked)
Controller fundamentals (fetching params)6m 44s
-
(Locked)
Controller fundamentals (@Put handler)10m 18s
-
(Locked)
Controller fundamentals (@Patch handler)4m 8s
-
(Locked)
Controller fundamentals (@Delete handler)3m 24s
-
(Locked)
Request object4m 42s
-
(Locked)
Response object2m 6s
-
(Locked)
Fetching queries3m 24s
-
(Locked)
@HttpCode vs. @Res decorator3m 22s
-
(Locked)
HTTP response status2m 53s
-
(Locked)
-
-
-
-
-
-
-
-
-
-