adspace


How to create an Http Server using Node.js?

Answer Posted / Mamata Kumari

To create an HTTP server using Node.js without any additional packages, follow these steps:
1. Import the http module.
2. Create a new instance of the http.Server object.
3. Define a request listener function that will handle incoming requests.
4. Pass the request listener function and a port number to the http.Server constructor.
5. Call the listen() method on the created server instance.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is node js losing popularity?

589


How we can read a file in node js?

568