I have a directory with some images in it that I want to make viewable in a browser.
This directory lives on my server at /public/images
Inside /public I also have other directories that I do not want to make public, hence making the entire /public directory viewable is not the solution.
How can I using the connect directory middleware make just my /public/images browsable?
Using the solution described here makes everything in /public viewable and trying the following doesn't work :
app.use(exp.static(__dirname + '/public'));
app.use(exp.static(__dirname + '/public/images'));
app.use(exp.directory(__dirname + '/public/images'));
Thanks
You have to mount your routes to a special path, like
app.use('/', exp.static(__dirname + '/public'));
app.use('/images', exp.static(__dirname + '/public/images'));
app.use('/images',exp.directory(__dirname + '/public/images'));
This way you can access the content of /public with the url / and the content of /public/image with the url /images