Serving static assets through wildcard rule
There is a better way.

If you wish to serve static files with express - it comes bundled with static middleware. To use it, you simply add this line before your routes:

app.use(express.static(__dirname + '/public'));


This may require slight adjustment to your paths but it replaces all those manual routes and is more efficient (caching, expiration etc).

Check out this example.

I would, however, suggest that you use something like nginx for your static assets since it's typically more robust and it'll free resources from your node server.