I have an api that uses a dynamic value. The dynamic value is a url parameter, [slug], from the page.
/map/[slug]
http://localhost:3001/map/slug
I tested my backend individually andit is able to retrieve the data from the database given its unique url id. I ran the project in Plasmic and it works as well. But when I run my application locally, it is unable to return data from the database. Whenever I run the backened individually and the project in Plasmic req.params.id returns the id from the url. But when I run my application locally req.params.id is being passed as undefined.
How do I go about this?
Hi, could you be more descriptive about your issue? Which framework are you using? How are you trying to connect Plasmic to the database? Providing images and snippets of code would make understanding your issue simpler.
Hi, thank you for your response. I am using Express.js. I am connecting Plasmic to the database by using an API call I created. Here is the Plasmic page where the API used. And the API call I made. Whenever I click on an item in the first image, I want the application to display the specific item with more details. It is able to run properly in Plasmic studio. But when I run my application locally with React.js, the value passed for req.params.id in the backend is passed as undefined.
Could you check that the correct value is being passed to pageRoute
and pageParams
in your PlasmicRootProvider
? Dynamic data-driven pages with code components | Learn Plasmic