Friday 27 July 2018

Problem with static files

Hi, I have an express app where users can change their profile image by uploading a photo. I use multer to do that. The picture's path is stored in the user's DB record (path is assets/uploadedImages/randomImageName). I use the path as the images src. In order to serve the folder with those images as a static file i tried doing app.use('/assets/uploadedImages', express.static('./assets/uploadedImages')). This works great for routes such as my home page localhost:3000, but when i have something like localhost:3000/users/userId this method stops working. I guess this is because of the / i have after users. How can i solve this issue?Thanks in advance ;)

Submitted July 27, 2018 at 03:16PM by everek123

No comments:

Post a Comment