const http = require(
'http'
);
const server = http.createServer(
function
(req, res) {
if
(req.url ==
'/'
) {
res.writeHead(200, {
'Content-Type'
:
'text/html'
});
res.write(
`<html><body style=
"text-align:center;"
>
<h1 style=
"color:green;"
>GeeksforGeeks Home Page</h1>
<p>A computer science portal</p>
</body></html>`);
res.end();
}
else
if
(req.url ==
"/webtech"
) {
res.writeHead(200, {
'Content-Type'
:
'text/html'
});
res.write(`
<html><body style=
"text-align:center;"
>
<h1 style=
"color:green;"
>Welcome to GeeksforGeeks</h1>
Read Web Technology content
</a>
</body></html>`);
res.end();
}
else
if
(req.url ==
"/DS"
) {
res.writeHead(200, {
'Content-Type'
:
'text/html'
});
res.write(`<html><body style=
"text-align:center;"
>
<h1 style=
"color:green;"
>GeeksforGeeks</h1>
Read Data Structures Content
</a>
</body></html>`);
res.end();
}
else
if
(req.url ==
"/algo"
) {
res.writeHead(200, {
'Content-Type'
:
'text/html'
});
res.write(`<html><body style=
"text-align:center;"
>
<h1 style=
"color:green;"
>GeeksforGeeks</h1>
Read Algorithm analysis and Design Content
</a>
</body></html>`);
res.end();
}
else
res.end(
'Invalid Request!'
);
}).listen(3000, () => console.log(
'Server running on port 3000'
));