ExpressJS Dynamic routes always return "cannot get"

Hi, i’ve deployed my NodeJS app containerised with Docker.
Normal fixed url paths work just fine, and API endpoints also work, but dynamic routes don’t (?)
And by dynamic routes, i mean like this:

app.get("/downloadpage/", (req, res) => {
  res.sendFile(path.join(__dirname, "./dist/index.html"));
});

I use MongoDB to store documents, each document’s download page is accessed by their unique _ID
This works perfectly locally using Docker, and also on a Linux VM (without docker)
I’m assuming the issue is related to render, so i kindly ask, is there any way to fix this?
(The app is a WebService)
Thanks for reading

Hi Hektor,

Are you getting errors when attempting to access your MongoDB? It would be most helpful if you could share those error logs.

Can you confirm you’re pointing Render to a valid MongoDB URL? Sometimes you may need to add your outbound Render IP addresses with your Mongo hosting provider.

Regards,

Matt

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.