Using Node JS a web server can be created. The advantages of Node JS are that it is event-driven and would not wait for the response of the previous call. It moves to the next call and takes advantage of events to get notifications when a response is received for a previous call. The servers built on Node JS are very fast and do not use buffering and transfers chunks of data. In addition to this, it is single threaded with event looping which is used in a non-blocking way. The HTTP module can help in creating a server by using the createServer() method. This method is executed whenever someone tries to access port 8080. In response to this, the HTTP server should display HTML and should be included in HTTP header. It can be installed easily by typing ‘npm install -g http-server’ and it can be started by typing http-server command.
4.5 (2,733 ratings)