Can we say node.js is a web server?


I found that I am confusing between web framework and web server.

Apache is a web server.

Tornado is a web server written in Python.

Nginx is a web server written in C

Zend is a web framework in php

Flask/Bottle is a web framework in Python

RoR is a web framework written in Ruby

Express is a web framework written in JS under Node.JS

Can we say node.js is a web server??? I am so confused between web server/ framework.

If somehow node.js is kind of webserver, not webframework (Express does), why do we need to put the whole node.js on top of Nginx server in useful practice?? Question on SO

Who can help???


7/2/2017 2:07:54 PM

Accepted Answer

Web server

Web server can refer to either the hardware (the computer) or the software (the computer application) that helps to deliver content that can be accessed through the Internet.1

The primary function of a web server is to deliver web pages on the request to clients. This means delivery of HTML documents and any additional content that may be included by a document, such as images, style sheets and scripts.

A web server is the basic to delivering requests/pagess to the clients/user on the internet

Web framework

A web application framework is a software framework that is designed to support the development of dynamic websites, web applications and web services. The framework aims to alleviate the overhead associated with common activities performed in Web development. For example, many frameworks provide libraries for database access, templating frameworks and session management, and they often promote code reuse.

A web framework uses a webserver to deliver the requests to client, but it is not the web server.


Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

But then again you can also create CLI apps so I think you should see it more as a platform to write javascript programs to run on your server(computer) using Javascript programming language instead of just in the browser as in the beginning. I think you could see it as Javascript++ ??

You can also write web server with node.js as you can see on the front page of node.js. In the beginning Ryan said you could put Nginx in front of node.js because of the stabilty of the project. The project was and still is pretty young. Nginx is a proven web server that will keep on running while node.js can crash. Then again a lot of user just use node.js for that.

2/28/2012 3:41:14 PM

I would say Node.js is a Runtime Environment or a Runtime Engine.

Probably the best definition I have found so far comes from an article by Rob Gravelle entitled "An Intro to Node.js":

Node.js is part runtime environment and part library for building network applications using server-side JavaScript. It uses Chrome's JavaScript runtime engine to execute JS code directly without the need for the browser sandbox.

Also the PCMAG.COM Encyclopedia provides the following definition of "runtime engine":

Software that certain applications depend on to run in the computer. The runtime engine must be running in the computer in order for the application to execute. It provides common routines and functions that the applications require, and it typically converts the program, which is in an interim, intermediate language, into machine language.

Also the Wikipedia article entitled "Run-time system" declares:

A run-time system (also called runtime system, runtime environment, or just runtime) implements the basic behavior of a computer language, whether the language is a compiled language, interpreted language, embedded domain-specific language, or is invoked via an API as is pthreads.

... A run-time system may implement behavior of tasks such as drawing text on the screen or making an Internet connection. It also typically acts as an abstraction layer that hides the complexity or variations in the services offered by the operating system.

Well, are there any runtime environments (or even software platforms) like Node.js out there? I guess JRE is a good example of such an environment. Node.js and JRE - they have many in common. They all have (a kind of) virtual machine, a class library and a framework to implement many types of applications, including CLI ones.

So, getting back to your question, can we say that Node.js is a web server? Let's change "Node.js" for "JRE" and answer if JRE is a web server. The answer is no.

All that we can say is that Node.js is a runtime environment which one may use to implement a web server. Well, that's my opinion.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow