Saturday, 25 July 2020

How to access file directly in express app?

I have a node app running on a server (say abc.com). On this I have a files folder in which I have some image files. Now when I try to access abc.com/logo.png it will give me error 404 because there is no route for it. Is there any way to achieve this without adding a new route.I triedapp.use(express.static(path.join(__dirname, 'files')));but it did not work.

Submitted July 25, 2020 at 01:04PM by GhostFoxGod

No comments:

Post a Comment