5 ms·
Yep, you shouldn't be using node to serve static files anyway. This is something a reverse proxy such as nginx should do. Node can then be used to serve either
by louischatriot 14y ago
Yep, you shouldn't be using node to serve static files anyway. This is something a reverse proxy such as nginx should do. Node can then be used to serve either as a pure API (serving json with express is the easiest way) for a webapp or render the webpages.
- wamatt 14y agonginx is not a bad choice, but would instead recommend node-http-proxy for most projects (including production). It's fast, easy to setup (npm install), and relatively hardened, while still keeping everything JS. As for static assets, those should probably be served from a CDN anyway, if one is concerned with performance.
- louischatriot 14y agoI agree about the CDN, even though for us performance is not so critical we need to use a CDN (yet). I didn't know node-http-proxy but it sounds interesting I'll check it out.