-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
27 lines (23 loc) · 678 Bytes
/
Copy pathserver.js
File metadata and controls
27 lines (23 loc) · 678 Bytes
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
const http= require ('http')
const server = http.createServer((req,res)=>{
// console.log(res)
// res.write('welcome Malek\n ')
// res.write('happy to see u again')
// res.end()
// res.write(req.url)
if(req.url =='/home'){
res.statusCode=200
res.write('welcome to home page')
}else if(req.url=='/contact'){
res.statusCode=200
res.write('welcome to contact page')
}else if (req.url =='/about'){
res.statusCode=200
res.write('welcome to about page ')
}else{
res.statusCode=404
res.write('not found')
}
res.end()
})
server.listen(5000,()=>{console.log('server running on port 5000 ')})