Images in my /public folder not rendering on my express app

I deployed my node js app on render, is monolith app(express and ejs) and it has a “/public” folder with scripts and images.
I try to call public files path and return Cannot GET .
In console has error in import of this public files.

Locally app works well.

HI,

There will always be differences between environments: development mode/Local, production mode/Render, etc. These differences need to be considered and configured as required for your own app in each environment.

If you have images in your repo, your Express app will need to be configured to serve them.

If you’re referring to uploading image to your running service, you’ll need to note that Render instances have an ephemeral filesystem, meaning any file written to the instance after it has booted will be lost when it next restarts (e.g. spun down if on free instance type, next deploy, manual restart, etc.).

If you want to use file uploads on your service, you’ll need to have a persistent store, e.g. a Render Disk (which is chargeable and also requires a paid instance type) or an external service like AWS S3.

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