R
Railwayβ€’11h ago
Nyn

Volumes

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?
No description
9 Replies
Percy
Percyβ€’11h ago
Project ID: 8c169380-53e9-4de5-a5f1-b56cefe00ebb
Nyn
NynOPβ€’11h ago
8c169380-53e9-4de5-a5f1-b56cefe00ebb
Solution
Brody
Brodyβ€’11h ago
please see our docs on this topic - https://docs.railway.com/guides/volumes#relative-paths
Nyn
NynOPβ€’11h ago
so would it be /app/uploads ? πŸ™‚ 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 πŸ™‚
Nyn
NynOPβ€’11h 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 πŸ˜„
Nyn
NynOPβ€’11h 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 });
}
const uploadsDir = path.join(process.cwd(), "/uploads");
if (!fs.existsSync(uploadsDir)) {
fs.mkdirSync(uploadsDir, { recursive: true });
}
`
Brody
Brodyβ€’10h ago
most likely check the volume metrics backend code should not use /app
Nyn
NynOPβ€’10h 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 πŸ™‚
Brody
Brodyβ€’10h ago
awsome
Want results from more Discord servers?
Add your server