Route all subdomains to their same-name folders

I have an Express app and want to route each subdomain to the corresponding folder of my filesystem. For instance, GET on example.com would look for file in ./, while blog.example.com would look for file in ./blog/, etc.

With this code I can append the subdomain to the requested route:

app.get('*', function(req, res, next){ 
  if(req.headers.host.indexOf('.example.com') > -1)
    req.url = '/' + req.headers.host.split('.')[0] + req.url
  next()
})

But then I have to add app.use('/blog', express.static('./blog')) for the blog, app.use('/docs', express.static('./docs')) for the docs, etc. I have to name each one of them.

How can I do a app.use('/*', express.static('./*')) ?

app.use('/', express.static('.')) seems to do just that.