Serve a random static file with Express

Share this video with your friends

Send Tweet

In this lesson we will look at serving static files using the static helper provided by Express.

We'll then use the file system module in Node to read the contents of our static directory, select a random file and send the path back to our client.