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.

Updating the product

Updating the product

Now, let's define the update functionality. Our first step is to display the product details inside the form when the edit button is clicked. Currently, when we click on the edit button, we get an error cannot get the route, though we are getting the product ID in the params. So let's update the route inside the home EJS file. I'll scroll down to the edit anchor and we'll update the href to slash product slash get one the product id. Giving the get one in the route because if we look at the product controller, we have set the get one route inside the get handler. Now let's check the output again. I'll click on the edit button and now it displays the product data from the products table. Now, we just have to render the edit product template. So I'll give the render decorator and the template name edit product. Now, this is not going to work, it will throw an error. Let's check it out first and then I'll explain. I'll click on the edit button again, and it shows an internal server…

Contents