From the course: Next.js: Creating and Hosting a Full-Stack Site
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Using route parameters in route handlers - React.js Tutorial
From the course: Next.js: Creating and Hosting a Full-Stack Site
Using route parameters in route handlers
- [Instructor] Well, now that we've created our first useful route handler for our e-commerce application, let's continue on, and we're actually going to take a look at a concept here that will make it much easier to load individual product data, which we're going to need to do on our product detail page. So what we're going to do here is, you may remember that when we created our product detail pages, which we can take a look at here just by going to slash products/123, we were able to refer to a specific product using the product's ID, and because of this, we were able to reuse the same page for multiple products, right? So we were able to say products/123 and see one product on that page, and then we were able to change this to like 345 and see a completely different product on that page. So the thing is that it would be really nice if we were able to do this same thing with route handlers, because that would allow us to load data for individual products instead of many products at…
Contents
-
-
-
-
What are Next.js route handlers?2m 12s
-
How do Next.js route handlers work?7m 29s
-
(Locked)
Testing route handlers with Postman7m 33s
-
(Locked)
Creating a list endpoint for products5m 42s
-
(Locked)
Using route parameters in route handlers8m 10s
-
(Locked)
Creating a shopping cart endpoint9m 5s
-
(Locked)
Creating an add-to-cart endpoint9m 7s
-
(Locked)
Challenge: Creating a remove-from-cart endpoint1m 23s
-
(Locked)
Solution: Creating a remove-from-cart endpoint5m 53s
-
-
-
-
-