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.
Configuring add product route - Nest.js Tutorial
From the course: Mastering Nest.js: Build Scalable Applications with Mastery in Nest.js Framework
Configuring add product route
Now, let's start working on the ad product page and route. So first of all, let's define the route for the ad product page. Inside the app controller, I'll give another get route handler with a route ad product, giving a method that is render ad product page, which returns null. So basically, configuring a route with Nest is this easy. Because in NestJS, you don't need to explicitly specify a router like you do in Express with express.router. Instead, we have the decorators that is the route handlers to define routes in a more declarative way. All right, moving on, I'll update the route for the homepage inside the get handler. And all the routes must fall under the my store route. Let's check if the ad product page is getting rendered. I'll give the route manually that is localhost slash my store slash ad product. And yes, the page is getting rendered. Now let's set this route in the nav bar and the home page. I'll open the home EJS file. Let's define the ad product route. I'll scroll…
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)
Introduction to MyStore application2m 43s
-
(Locked)
Rendering template on server4m 41s
-
(Locked)
Creating navbar with "includes"3m 31s
-
(Locked)
Creating home interface9m 6s
-
(Locked)
Conditional rendering: No product found2m 26s
-
(Locked)
Configuring add product route2m 29s
-
(Locked)
Creating "add product" interface5m 51s
-
(Locked)
Configuring edit product route1m 49s
-
(Locked)
Interface & functionality: Edit product4m 10s
-
(Locked)
-
-
-
-