-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkickNodeTask7.js
38 lines (33 loc) · 1.05 KB
/
kickNodeTask7.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const http=require('http');
const server=http.createServer((req,res) => {
const url=req.url;
//const method=req.method;
if(url==='/home')
{
res.setHeader('Content-Type','text/html');
res.write('<html>');
res.write('<head><title>My First home Page</title></head>');
res.write('<body><h1>Welcome home</h1></body>')
res.write('</html>');
return res.end();
}
if(url==='/about')
{
res.setHeader('Content-Type','text/html');
res.write('<html>');
res.write('<head><title>My First about Page</title></head>');
res.write('<body><h1>Welcome to About Us page</h1></body>')
res.write('</html>');
return res.end();
}
if(url==='/node')
{
res.setHeader('Content-Type','text/html');
res.write('<html>');
res.write('<head><title>My First node Page</title></head>');
res.write('<body><h1>Welcome to my Node Js project</h1></body>')
res.write('</html>');
return res.end();
}
});
server.listen(3000);