Express.js (Node.js): How does static file serving really work?
But it seems that Static Files "just work" with Express. No special thing is required.
How does Express static file serving really work?
Why do some people advocate using nginx for static files? There must be a good reason for this. (Example: https://gist.github.com/joemccann/644282)
Also, while a static file is downloading, does the Node.js event queue get blocked? I suppose not, but why not?
If the url does not belong to any paths that you registered via
app.get(/... (or POST etc.) methods, Express sends the file if the static path is set and the path that you give belongs to some files path under static files directory. File sending is nothing more than streams, they do not block the event queue completely, they are just pushed to the queue and as chunks recieved, they are piped to the HTTP connection, so they happen on the background of your code. The reason of suggesting nginx is that it is more fit to that job, serving files and routing, and it is also written in C, and optimized for that job, where the NodeJS is a more general-purpose tool compared to Nginx.