Hello, how to use Volume?

Hello, i need to use a Volume to store images. I need then to show the images on a website
20 Replies
Percy
Percy10mo ago
Project ID: 6a68e036-a32d-403b-872c-b546785ea48e
ZannaKonda
ZannaKondaOP10mo ago
i have my volume mounted to /media and i am storing the files in /media/userId/year/filename.png it seems to be saved correctly but then i cannot see it
Brody
Brody10mo ago
I assume this is django?
ZannaKonda
ZannaKondaOP10mo ago
Hey Brody nextjs website
Brody
Brody10mo ago
haha bad guess, django by default uses /media the paths you are giving me, they are absolute paths correct? then I would need more information than "cannot see it"
ZannaKonda
ZannaKondaOP10mo ago
const filename = ${userId}/${now.getFullYear()}/${now.getMonth()}/${name}; ensureDirectoryExistence(${process.env.RAILWAY_VOLUME_MOUNT_PATH}/${filename}); fs.writeFileSync(${process.env.RAILWAY_VOLUME_MOUNT_PATH}/${filename}, base64Image, { encoding: 'base64' }); this is how i save it if i point by browser to railway.app/media/............/filename.png i have a not found i think i found that by default the files are stored under app folder so the url should be railway.app/app/media.... correct?
Brody
Brody10mo ago
are you setting up your next app to serve those files at that path? railway does not serve the files for you, that's something your app has to do entirely on it's own
ZannaKonda
ZannaKondaOP10mo ago
how can i access the files so? nope i guess
Brody
Brody10mo ago
then you know what you need to do, setup a file server in your code
ZannaKonda
ZannaKondaOP10mo ago
Stack Overflow
Node.js quick file server (static files over HTTP)
Is there Node.js ready-to-use tool (installed with npm), that would help me expose folder content as file server over HTTP. Example, if I have D:\Folder\file.zip D:\Folder\file2.html D:\Folder\fo...
Brody
Brody10mo ago
I'm talking about in your existing code, that's something else entirely separate
ZannaKonda
ZannaKondaOP10mo ago
No description
ZannaKonda
ZannaKondaOP10mo ago
isn't it what i need to? too?
Brody
Brody10mo ago
I'm talking about in your existing code, that's something else entirely separate
ZannaKonda
ZannaKondaOP10mo ago
in the link they suggest to install (IN MY CODE) a package to expose files over http would this be enough?
Brody
Brody10mo ago
the solution with the check mark does not involve your pre-existing code it recommends something completely separate and standalone you need a solution that integrates with your next app to serve files from disk at a given path
ZannaKonda
ZannaKondaOP10mo ago
ok i think i got it thanks
ZannaKonda
ZannaKondaOP10mo ago
it should be something like this
No description
ZannaKonda
ZannaKondaOP10mo ago
i will try tomorrow thanks again
Brody
Brody10mo ago
that's express, but yes an in code file server would need to be setup I have seen countless next apps that serve arbitrary files from disk, so there must be something standardised for next
Want results from more Discord servers?
Add your server