app.js 2.49 KB
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("./index.html").pipe(res);
})



app.get('/vs_lg',function(req,res){
    if(lotte.v>lg.v){
        res.send('Lotte VS LG : Lotte Win!');
    }
    else{
        res.send('Lotte VS LG : LG Win!');
    }
})

app.get('/vs_kia',function(req,res){
    if(lotte.v>kia.v){
        res.send('Lotte VS Kia : Lotte Win!');
    }
    else{
        res.send('Lotte VS Kia : Kia Win!');
    }
})

app.get('/vs_sk',function(req,res){
    if(lotte.v>sk.v){
        res.send('Lotte VS SK : Lotte Win!');
    }
    else{
        res.send('Lotte VS SK : SK Win!');
    }
})

app.get('/vs_hanhwa',function(req,res){
    if(lotte.v>hanhwa.v){
        res.send('Lotte VS Hanhwa : Lotte Win!');
    }
    else{
        res.send('Lotte VS Hanhwa : HanHwa Win!');
    }
})

app.get('/vs_nc',function(req,res){
    if(lotte.v>nc.v){
        res.send('Lotte VS NC : Lotte Win!');
    }
    else{
        res.send('Lotte VS NC : NC Win!');
    }
})

app.get('/vs_doosan',function(req,res){
    if(lotte.v>doosan.v){
        res.send('Lotte VS Doosan : Lotte Win!');
    }
    else{
        res.send('Lotte VS Doosan : Doosan Win!');
    }
})

app.get('/vs_samsung',function(req,res){
    if(lotte.v>samsung.v){
        res.send('Lotte VS Samsung : Lotte Win!');
    }
    else{
        res.send('Lotte VS Samsung : Samsung Win!');
    }
})

app.get('/vs_kiwoom',function(req,res){
    if(lotte.v>kia.v){
        res.send('Lotte VS Kiwoom : Lotte Win!');
    }
    else{
        res.send('Lotte VS Kiwoom : Kiwoom Win!');
    }
})

app.get('/vs_kt',function(req,res){
    if(lotte.v>kia.v){
        res.send('Lotte VS KT : Lotte Win!');
    }
    else{
        res.send('Lotte VS KT : KT Win!');
    }
})

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)
})