Reputation: 9291
I'm working on a project where there is a user uploaded collection of styles, scripts and images and then their is my app's collection of styles, scripts and images. They're two different places on my server.
Is there anyway I can setup Express in Node.js so it can more than one static folder? I'm wanting it to serve both - obviously, I'd make sure of directory and file name conflicts. Is that even possible?
The way I have for one static folder at this moment is like this:
this.use(express.static(__dirname + '/public'));
...but I'm wanting to directories for static files.
Or is there totally different another way I could achieve this?
Thanks, James
Upvotes: 3
Views: 1681
Reputation: 14602
this.use(express.static(__dirname + '/public1'));
this.use(express.static(__dirname + '/public2'));
The first one will have priority with regards to filenames.
Upvotes: 8