node.js - Is there any way to have Express draw from two file system directories for one web directory? -



node.js - Is there any way to have Express draw from two file system directories for one web directory? -

say want have apparent directory that, via browser, http://whatever/images/

but on file system, draws both /users/me/www/images , /users/me/moreimages/. if request http://whatever/images/selfie.jpg, first /users/me/www/images/selfie.jpeg, , if isn't found, serve /users/me/moreimages/selfie.jpeg instead.

i can think of ugly ways of doing this, handling routing , serving myself, i'd in "correct" , straightforward way. express have workaround can cause this?

yes, possible. have 2 instances of express.static both mounted on /images:

router.use('/images', express.static('/users/me/images/')); router.use('/images', express.static('/users/me/moreimages/'));

if request not satisfied in first instance of middleware, sec 1 processed, , on.

node.js express

Comments

Popular posts from this blog

php - Edges appear in image after resizing -

ios8 - iOS custom keyboard - preserve state between appearances -

Delphi change the assembly code of a running process -