Multiple concurrent static hosting contexts
Problem
If I have a project directory that looks like the following:
/
custom_assets
File1.txt
generic_assets
File2.txt
Is there a node http server implementation that would allow me to host both directories from the same root url?
For example:
http://localhost/File1.txt
Or
http://localhost/File2.txt
Almost like as if the two directories were merged.
Problem courtesy of: Omega
Solution
ExpressJS which is a popular node web application framework can do it. Using two static middlewares should do the trick.
Your code should look like this:
app.use(express.static(__dirname + '/custom_assets'));
app.use(express.static(__dirname + '/generic_assets'));
Solution courtesy of: drorw
Discussion
View additional discussion.