Showing
12 changed files
with
91 additions
and
116 deletions
... | @@ -11,7 +11,7 @@ | ... | @@ -11,7 +11,7 @@ |
11 | "skipFiles": [ | 11 | "skipFiles": [ |
12 | "<node_internals>/**" | 12 | "<node_internals>/**" |
13 | ], | 13 | ], |
14 | - "program": "${workspaceFolder}\\test.js" | 14 | + "program": "${workspaceFolder}\\app.js" |
15 | } | 15 | } |
16 | ] | 16 | ] |
17 | } | 17 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
app.js
0 → 100644
1 | +var express = require('express'); | ||
2 | +var app = express(); | ||
3 | + | ||
4 | +app.set("view engine","ejs"); | ||
5 | +app.use(express.static(__dirname + '/public')); | ||
6 | + | ||
7 | +app.get("/", function(req,res){ | ||
8 | + res.render("index", {low:arr[0],middle:arr[1],high:arr[2]}); | ||
9 | +}); | ||
10 | + | ||
11 | +var location; | ||
12 | +app.get("/:location", function(req,res){ | ||
13 | + location = req.params.location; | ||
14 | + res.render("index", {low:arr[0],middle:arr[1],high:arr[2]}); | ||
15 | +}); | ||
16 | + | ||
17 | +app.listen(8080, function(){ | ||
18 | + console.log('Server On!'); | ||
19 | +}); | ||
20 | + | ||
21 | +const {PythonShell} = require('python-shell'); | ||
22 | + | ||
23 | +var options = { | ||
24 | + mode: 'text', | ||
25 | + pythonOptions: ['-u'], | ||
26 | + scriptPath: '', | ||
27 | + encoding: 'utf8', | ||
28 | + args: ["영통1동"] | ||
29 | +}; | ||
30 | + | ||
31 | +var arr = new Array(); | ||
32 | +var test = new PythonShell('recommend_clothes.py', options); | ||
33 | +var data= location; | ||
34 | +test.send(data); | ||
35 | +test.on('message',function(message){ | ||
36 | + arr.push(message); | ||
37 | + console.log(arr); | ||
38 | +}) | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
index.html
deleted
100644 → 0
1 | -<!DOCTYPE html> | ||
2 | -<html lang="en"> | ||
3 | - | ||
4 | -<head> | ||
5 | - <meta charset="UTF-8"> | ||
6 | - <title>OSSW</title> | ||
7 | - <link rel="stylesheet" href="/style.css" crossorigin="anonymous"> | ||
8 | - <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" | ||
9 | - integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> | ||
10 | - <link href="https://fonts.googleapis.com/css?family=Noto+Sans+KR&display=swap" rel="stylesheet"> | ||
11 | -</head> | ||
12 | - | ||
13 | -<body> | ||
14 | - <nav class="navbar navbar-light bg-light" style="border-bottom: 1px solid lightgray;"> | ||
15 | - <a class="navbar-brand" href="#" style="margin-left: 15px;"> | ||
16 | - <img src="/image/logo.png" style="height:250px;"/> | ||
17 | - </a> | ||
18 | - </nav> | ||
19 | - <div class = "main"> | ||
20 | - <img src="/image/thermometer.jpg" class = "icon"> | ||
21 | - </div> | ||
22 | - <div class = "sub"> | ||
23 | - <input type="text" id="location_input" value="영통1동" autofocus="true"> | ||
24 | - <button id="location_button" onclick="button_click()">입력</button> | ||
25 | - </div> | ||
26 | - <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" | ||
27 | - integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" | ||
28 | - crossorigin="anonymous"></script> | ||
29 | - <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" | ||
30 | - integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" | ||
31 | - crossorigin="anonymous"></script> | ||
32 | - <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT" crossorigin="anonymous"></script> | ||
33 | - <script src ="/js/app.js"></script> | ||
34 | -</body> | ||
35 | - | ||
36 | -</html> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
js/app.js
deleted
100644 → 0
File moved
public/js/agency.js
0 → 100644
1 | +var jsdom = require("jsdom"); | ||
2 | +const { JSDOM } = jsdom; | ||
3 | +const { window } = new JSDOM(); | ||
4 | +const { document } = (new JSDOM('')).window; | ||
5 | +var $ = jQuery = require('jquery')(window); | ||
6 | +const appdata = require('../../app'); | ||
7 | + | ||
8 | +var data = "영통1동"; | ||
9 | + | ||
10 | +function button_click(){ | ||
11 | + data= $('#location_input').val(); | ||
12 | + $(".low").text(appdata.tLow); | ||
13 | +} | ||
14 | + | ||
15 | + exports.location = data; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -18,7 +18,6 @@ for cell in sheet['E']: | ... | @@ -18,7 +18,6 @@ for cell in sheet['E']: |
18 | sys.stdin.reconfigure(encoding='utf-8') | 18 | sys.stdin.reconfigure(encoding='utf-8') |
19 | sys.stdout.reconfigure(encoding='utf-8') | 19 | sys.stdout.reconfigure(encoding='utf-8') |
20 | area = input() | 20 | area = input() |
21 | -print(area) | ||
22 | col = code.index(area) | 21 | col = code.index(area) |
23 | area_code_index = 'B' + str(col+1) | 22 | area_code_index = 'B' + str(col+1) |
24 | area_code = sheet[area_code_index].value | 23 | area_code = sheet[area_code_index].value | ... | ... |
test.js
deleted
100644 → 0
1 | -var http = require('http'); | ||
2 | -var fs = require('fs'); | ||
3 | -var app = http.createServer(function(request,response){ | ||
4 | - var url = request.url; | ||
5 | - if(request.url == '/'){ | ||
6 | - url = '/index.html'; | ||
7 | - } | ||
8 | - if(request.url == '/favicon.ico'){ | ||
9 | - response.writeHead(404); | ||
10 | - response.end(); | ||
11 | - return; | ||
12 | - } | ||
13 | - response.writeHead(200); | ||
14 | - response.end(fs.readFileSync(__dirname + url)); | ||
15 | - | ||
16 | -}); | ||
17 | -app.listen(8080); | ||
18 | - | ||
19 | - | ||
20 | - | ||
21 | - | ||
22 | -const {PythonShell} = require('python-shell'); | ||
23 | - | ||
24 | -var options = { | ||
25 | - mode: 'text', | ||
26 | - pythonOptions: ['-u'], | ||
27 | - scriptPath: '', | ||
28 | - encoding: 'utf8', | ||
29 | - args: ["영통1동"] | ||
30 | -}; | ||
31 | - | ||
32 | - | ||
33 | -const appdata = require('./js/app.js'); | ||
34 | - | ||
35 | -var arr; | ||
36 | -var test = new PythonShell('recommend_clothes.py', options); | ||
37 | -var data= appdata.locationData(); | ||
38 | -test.send(data); | ||
39 | -test.on('message',function(message){ | ||
40 | - arr = message.split('\n'); | ||
41 | - console.log(arr); | ||
42 | -}) | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -4,7 +4,7 @@ | ... | @@ -4,7 +4,7 @@ |
4 | <head> | 4 | <head> |
5 | <meta charset="UTF-8"> | 5 | <meta charset="UTF-8"> |
6 | <title>OSSW</title> | 6 | <title>OSSW</title> |
7 | - <link rel="stylesheet" href="/style.css" crossorigin="anonymous"> | 7 | + <link rel="stylesheet" href="../css/style.css" crossorigin="anonymous"> |
8 | <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" | 8 | <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" |
9 | integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> | 9 | integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> |
10 | <link href="https://fonts.googleapis.com/css?family=Noto+Sans+KR&display=swap" rel="stylesheet"> | 10 | <link href="https://fonts.googleapis.com/css?family=Noto+Sans+KR&display=swap" rel="stylesheet"> |
... | @@ -13,34 +13,46 @@ | ... | @@ -13,34 +13,46 @@ |
13 | <body> | 13 | <body> |
14 | <nav class="navbar navbar-light bg-light" style="border-bottom: 1px solid lightgray;"> | 14 | <nav class="navbar navbar-light bg-light" style="border-bottom: 1px solid lightgray;"> |
15 | <a class="navbar-brand" href="#" style="margin-left: 15px;"> | 15 | <a class="navbar-brand" href="#" style="margin-left: 15px;"> |
16 | - <img src="/image/logo.png" style="height:250px;"/> | 16 | + <img src="./image/logo.png" style="height:250px;" /> |
17 | </a> | 17 | </a> |
18 | </nav> | 18 | </nav> |
19 | - <div class = "main"> | 19 | + <div class="first"> |
20 | - <span class="result_icon"> | 20 | + <div class="main"> |
21 | - <div>최저</div> | 21 | + <img src="./image/thermometer.jpg" class="icon"> |
22 | - <div class="low temper">3ºC</div> | 22 | + </div> |
23 | - </span> | 23 | + <div class="sub"> |
24 | - <span class = "result_icon"> | 24 | + <input type="text" id="location_input" value="영통1동" autofocus="true"> |
25 | - <div>평균</div> | 25 | + <button id="location_button" type="button" onclick="button_click()">입력</button> |
26 | - <div class="middle temper">5ºC</div> | 26 | + </div> |
27 | - </span> | ||
28 | - <span class = "result_icon"> | ||
29 | - <div>최고</div> | ||
30 | - <div class="high temper">7ºC</div> | ||
31 | - </span> | ||
32 | </div> | 27 | </div> |
33 | - <div class = "sub"> | 28 | + <div class="second"> |
29 | + <div class="main"> | ||
30 | + <span class="result_icon"> | ||
31 | + <div>최저</div> | ||
32 | + <div class="low temper"><%=low%>ºC</div> | ||
33 | + </span> | ||
34 | + <span class="result_icon"> | ||
35 | + <div>평균</div> | ||
36 | + <div class="middle temper"><%=middle%>ºC</div> | ||
37 | + </span> | ||
38 | + <span class="result_icon"> | ||
39 | + <div>최고</div> | ||
40 | + <div class="high temper"><%=high%>ºC</div> | ||
41 | + </span> | ||
42 | + </div> | ||
43 | + <div class="sub"> | ||
44 | + </div> | ||
34 | 45 | ||
35 | - </div> | 46 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" |
36 | - <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" | 47 | + integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" |
37 | - integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" | 48 | + crossorigin="anonymous"></script> |
38 | - crossorigin="anonymous"></script> | 49 | + <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" |
39 | - <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" | 50 | + integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" |
40 | - integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" | 51 | + crossorigin="anonymous"></script> |
41 | - crossorigin="anonymous"></script> | 52 | + <script src="https://code.jquery.com/jquery-3.3.1.min.js" |
42 | - <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT" crossorigin="anonymous"></script> | 53 | + integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT" |
43 | - <script src ="/js/app.js"></script> | 54 | + crossorigin="anonymous"></script> |
55 | + <script src = "/js/agency.js"></script> | ||
44 | </body> | 56 | </body> |
45 | 57 | ||
46 | </html> | 58 | </html> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment