-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
25 lines (21 loc) · 845 Bytes
/
test.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
var http = require('http')
var log = require('./log.js')
var SayHello = require('./exportsDemo.js')
var data = JSON.stringify({name:'Berke',LastName:'Space'})
http.createServer(function(request,response){
console.log(request.url)
if(request.url=="/admin"){
response.writeHead(200,{'Content-Type':'text/html'})
response.write('<html><body><strong>Admin Page</strong></body></html> ')
}else if(request.url=="/"){
response.writeHead(200,{'Content-Type':'text/html'})
response.write('<html><body><strong>Home Page</strong></body></html> ')
}else if(request.url=="/customer"){
response.writeHead(200,{'Content-Type':'application/json'})
response.write(data)
}
response.end('')
}).listen(8080)
log.information('Server Started at : ')
console.log(data)
console.log(SayHello())