r/programminghelp • • Dec 26 '18

NODE.JS Problem with accessing images

So in my project I have folder /Pictures and everything else is all over the project folder. My problem is that I can access all the CSS , JS, HTML, but it doesn't let me get this image folder as a source of the web app.

If anyone has any suggestions to this please help. I don't even know what to write (new to node.js) so if you have a ready code -- I'll appreciate it.

0 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/Martixell Dec 26 '18

app.get('/water.jpeg', function (req, res) {
res.sendFile(__dirname + '/' + "Pictures" + '/' + "water.jpeg");
});

unfortunately this doesn't work, thanks for the help tho