0% found this document useful (0 votes)
15 views3 pages

Simple Node.js Web Server Setup

Uploaded by

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

Simple Node.js Web Server Setup

Uploaded by

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

creating web server

const http=require('http')

const host="[Link]"

const port=3000

const server=[Link]((req,res)=>{

[Link](200);

[Link]('<h1>Handsome boy Narayana</h1>');

[Link]();

})

[Link](port,host,()=>{

[Link]("Server run on [Link]

})

output:

node [Link]

Server run on [Link]

Changing url’s:

const http=require('http')

const server=[Link]((req,res)=>{

if([Link]=='/'){

[Link](200) ;

[Link]("<h1>Morning Boss </h1>");

[Link]();

}
else if([Link]=='/about')

[Link](200) ;

[Link]("<h1>Afternoon Boss</h1>");

[Link]();

Output:

node [Link]

Server run on [Link]

You might also like