NODE.JS Create an HTTP Server
LEARN NODE.JS Create an HTTP Server Node was designed with back end development needs as a top priority. One of these needs is the ability to create web servers, computer processes that listen for requests from clients and return responses. A Node core module designed to meet these needs is the http module. This module contains functions which simplify interacting with HTTP and streamline receiving and responding to requests. The http.createServer() method returns an instance of an http.server . An http.server has a method .listen() which causes the server to “listen” for incoming connections. When we run http.createServer() we pass in a custom callback function (often referred to as the requestListener ). This callback function will be triggered once the server is listening and receives a request. Let’s break down how the requestListener callback function works: The function expects two arguments: a request object and a response object. Each time a request to the serv