Volumes
karlsson2
HOBBYOP

a year ago

I have an express application that uploads images to an /uploads folder in my express application.

Ies it correct to mount a volume to /uploads in order to have persistent storage of the images in that folder?

11 Replies

karlsson2
HOBBYOP

a year ago

8c169380-53e9-4de5-a5f1-b56cefe00ebb


a year ago

please see our docs on this topic -


karlsson2
HOBBYOP

a year ago

so would it be /app/uploads ? 🙂


karlsson2
HOBBYOP

a year ago

Is there a way to check the contents of the volume so that I know something has been uploaded there ? New to railway and trying to see if it makes sense on a client project 🙂


karlsson2
HOBBYOP

a year ago

My code generates urls like such: https://exarbete-production.up.railway.app/uploads/eventImage-1731874140525-205047834.jpg

just trying to figure out if this has actually ended up in persistent storage or not 😄


karlsson2
HOBBYOP

a year ago

or does this backend code need to reflect the app/uploads bit? i feel like the documentation isn't super clear, or I might not understand it fully 😄

const uploadsDir = path.join(process.cwd(), "/uploads");
if (!fs.existsSync(uploadsDir)) {
  fs.mkdirSync(uploadsDir, { recursive: true });
}

`


a year ago

most likely


a year ago

check the volume metrics


a year ago

backend code should not use /app


karlsson2
HOBBYOP

a year ago

Yeah solved it eventually, the issue i was facing was that the images I was uploading was so small that the metrics didn't seem to detect them being uploaded. Uploaded some bigger ones and got some reaction 🙂


a year ago

awsome


Loading...