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

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…

Contents