Handle Dynamic Requests with Path Parameters in MSW

Share this video with your friends

Send Tweet

When mocking a collection of resources in Mock Service Worker, such as our movies, you will encounter requests that have dynamic parts in their URL, like /movies/:slug. In this lesson, learn how to use path parameters to describe dynamic portions of the request's URL, access those parameters, and return a different response based on their values.

~ 9 months ago

Complete noob here, Any idea why I am seeing just black screen without any errors in web console, when run the app using "npm run dev" command in the main folder ? I just cloned repository and run npm install in the main folder, and then try to run with no success. I didnt even started msw part of the tutorial. Thanks for any suggestions.

Artem Zakharchenko
Artem Zakharchenko(instructor)
~ 9 months ago

Hi! Thanks for letting me know. I believe the issue is fixed now, the app is functional. Don't hesitate to ping me in case you spot any other problems!

~ 7 months ago

Hi, I created a new Remix app v2.9.1 and copied/updated all necessary files for my starter project. So, I expect issues. Everything is working at the moment.

But FYI I have to restart the dev server every time I create a handler so it will take affect.

Artem Zakharchenko
Artem Zakharchenko(instructor)
~ 7 months ago

Hi! I believe this course has been recorded on an earlier version of Remix.

Please see our MSW + Remix usage example that features the latest Remix and doesn't have any HMR issues. Hope that helps!

~ 7 months ago

The MSW + Remix example seems to have an old version of Remix and no Vite. But the problem seems to have worked it's self out as I progressed through the course. Not sure what I changed or if it was actually a problem with my slow PC. Thanks though.

Artem Zakharchenko
Artem Zakharchenko(instructor)
~ 6 months ago

No worries! Although the course app uses old Remix, nothing in what I teach in these lessons is Remix-specific or breaks between Remix versions. I will update the app once I have a day to spare.