Can Node.js fully replace solutions like Apache or NGINX?

Both Apache and NGINX are fully developed web servers offering lots of modules and services out of the box. They’re considered robust and has proven stability for several years now.

Having that sort of available solutions, there’s no need to re-invent the wheel. It can be more beneficial to implement the load balancer and routing with NGINX and not expose NodeJS to the outside and just run it on localhost.

NodeJS can’t be considered a server software but merely a JavaScript engine plus libraries/modules. The fact that it’s heavily used for server scripting does not make it web server.

If you decide to overlook the above and switch to NodeJS completely, i offer you think about maintaining such a solution. Logging, startup/shutdown scripts and monitoring can make the task more complicated than it seems.

Further more, numerous libraries written for NodeJS tend to break with new versions delivered, as breaking changes are introduced by NodeJS. Consider that as the price for the lack of maturity. If you’re up to the risk and not afraid of problems, go for NodeJS.

Final note: static files can be served with NodeJS. Your scripts may read it and push it out.

Update: If you decided to go for Node.js consider to use Express.js framework.

Leave a Comment