Last Updated: February 25, 2016
·
398
· andrewhao

Using Express 3.x directory middleware

In order to mount a subdirectory, make files within it downloadable and browseable, you must remember to supply a first argument to app.use that begins with your directory route.

app.use("/uploads", express.static('uploads'))
app.use("/uploads", express.directory('uploads'))

If you don't supply it, your route only mounts at the / path.