Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
How can I use DO block storage as static folder in express app?
I can’t seem to find an existing answer to my problem, so I hope someone can help me here:
I have an app with express backend where users can upload images that show up on their profile page.
Right now (in development) all files are served by express through
app.use('/public', express.static(__dirname + '/public'))
Now I decided on DO for deployment (which btw ran quite smoothly using dokku, thanks for that!) and wanted to ask if there is a simple way to have express serve (and upload) the files from (and to) DO block storage - so that the front end is still able to access all files from
That would be amazingly helpful.
(btw, the uploaded images get resized and saved in 3 versions each and the therefor existing folder structure is why I thought it was better to go with block storage vs. object storage - but I would be also open for suggestions on how to make this work using object storage)
Thanks in advance and sorry if I’m missing something obvious!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×