Monday, 29 May 2017

list and serve static files in directory in node.js via browser

How do I get the equivalent functionality of this in node.js? apache list files in directory

please see image attached. I am able to serve static files, with the following code:

app.use('/videos', express.static('videos'));

this allows me to access and download my videos if I specify the full path to the file. however, how do i list all the files in the directory like the one in the screen shot above?

In apache, its as simple as not having an index.html in the folder you are serving on that virtual host. How do I do this in node.js + express?



via tritium_3

No comments:

Post a Comment