0% found this document useful (0 votes)
5 views1 page

Simple Node.js Web Server Example

Uploaded by

pprash406
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Simple Node.js Web Server Example

Uploaded by

pprash406
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Node.

js Sample Project
This is a simple [Link] sample project that demonstrates a basic web server using the built-in 'http'
module. The server listens on port 3000 and responds with a welcome message.

Code Example:
// [Link] const http = require("http"); const hostname = "[Link]"; const port = 3000;
const server = [Link]((req, res) => { [Link] = 200;
[Link]("Content-Type", "text/html"); [Link]("Welcome to My [Link] App ■"); });
[Link](port, hostname, () => { [Link](`Server running at
[Link] });

How to Run: 1. Install [Link] ([Link] 2. Save the code in a file named [Link]. 3. Open
your terminal and run: node [Link] 4. Open your browser and visit: [Link]

You might also like