app.js
4.02 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
var XLSX = require('xlsx');
var express = require('express')
var app = express();
var fs = require('fs');
var http = require('http');
var workbook = XLSX.readFile('data.xlsx');
var firstWsheetName = workbook.SheetNames[0];
var firstWsheet = workbook.Sheets[firstWsheetName];
var lotte = firstWsheet['P2'];
var lg = firstWsheet['P3'];
var sk = firstWsheet['P4'];
var hanhwa = firstWsheet['P5'];
var nc = firstWsheet['P6'];
var doosan = firstWsheet['P7'];
var samsung = firstWsheet['P8'];
var kia = firstWsheet['P9'];
var kiwoom = firstWsheet['P10'];
var kt = firstWsheet['P11'];
app.get('/',function(req,res){
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/index.html").pipe(res);
})
app.get('/info',function(req,res){
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/info.html").pipe(res);
})
app.get('/vs',function(req,res){
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/vs.html").pipe(res);
})
app.get('/vs/lg',function(req,res){
if(lotte.v>lg.v){
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/lg_l.html").pipe(res);
}
else{
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/lg_w.html").pipe(res);
}
})
app.get('/vs/kia',function(req,res){
if(lotte.v>kia.v){
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/kia_l.html").pipe(res);
}
else{
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/kia_w.html").pipe(res);
}
})
app.get('/vs/sk',function(req,res){
if(lotte.v>sk.v){
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/sk_l.html").pipe(res);
}
else{
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/sk_w.html").pipe(res);
}
})
app.get('/vs/hanhwa',function(req,res){
if(lotte.v>hanhwa.v){
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/hanhwa_l.html").pipe(res);
}
else{
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/hanhwa_w.html").pipe(res);
}
})
app.get('/vs/nc',function(req,res){
if(lotte.v>nc.v){
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/nc_l.html").pipe(res);
}
else{
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/nc_w.html").pipe(res);
}
})
app.get('/vs/doosan',function(req,res){
if(lotte.v>doosan.v){
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/doosan_l.html").pipe(res);
}
else{
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/doosan_w.html").pipe(res);
}
})
app.get('/vs/samsung',function(req,res){
if(lotte.v>samsung.v){
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/samsung_l.html").pipe(res);
}
else{
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/samsung_w.html").pipe(res);
}
})
app.get('/vs/kiwoom',function(req,res){
if(lotte.v>kia.v){
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/kiwoom_l.html").pipe(res);
}
else{
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/kiwoom_w.html").pipe(res);
}
})
app.get('/vs/kt',function(req,res){
if(lotte.v>kia.v){
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/kt_l.html").pipe(res);
}
else{
res.writeHead(200,{"Content-Type":"text/html"});
fs.createReadStream("./html/kt_w.html").pipe(res);
}
})
var server = app.listen(23023,function(){
var host = server.address().address
var port = server.address().port
console.log("Listening at http://%s:%s",host,port)
})