-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver2.js
89 lines (49 loc) · 1.33 KB
/
server2.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
const PORT = 8080;
const ADDRESS = '0.0.0.0';
var http = require('http');
var server1 = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
//res.end('Hello World\n');
//console.log(req);
//console.log(res);
console.log('req.method => '+req.method);
console.log('req.url => '+req.url);
if(req.url==='/start') {
} else
if(req.url==='/end') {
} else
if(req.url==='/init') {
} else
if(req.url==='/balance') {
} else
if(req.url==='/check') {
}
res.end('end.\n');
});
var server2 = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
//res.end('Hello World\n');
//console.log(req);
//console.log(res);
console.log('req.method => '+req.method);
console.log('req.url => '+req.url);
if(req.url==='/start') {
} else
if(req.url==='/end') {
} else
if(req.url==='/init') {
} else
if(req.url==='/balance') {
} else
if(req.url==='/check') {
}
res.end('end.\n');
});
server1.listen(8080, ADDRESS, function () {
console.log('Server #1 running at http://%s:%s/', ADDRESS, '8080');
console.log('Press CTRL+C to exit');
});
server2.listen(8081, ADDRESS, function () {
console.log('Server #2 running at http://%s:%s/', ADDRESS, '8081');
console.log('Press CTRL+C to exit');
});