Update run_server.js settings to show html and .gitignore to ignore .vscode folder
Showing
12 changed files
with
53 additions
and
68 deletions
... | @@ -7,6 +7,9 @@ yarn-error.log* | ... | @@ -7,6 +7,9 @@ yarn-error.log* |
7 | lerna-debug.log* | 7 | lerna-debug.log* |
8 | .pnpm-debug.log* | 8 | .pnpm-debug.log* |
9 | 9 | ||
10 | +# Vscode | ||
11 | +.vscode/ | ||
12 | + | ||
10 | # Diagnostic reports (https://nodejs.org/api/report.html) | 13 | # Diagnostic reports (https://nodejs.org/api/report.html) |
11 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | 14 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json |
12 | 15 | ||
... | @@ -123,4 +126,11 @@ dist | ... | @@ -123,4 +126,11 @@ dist |
123 | .yarn/unplugged | 126 | .yarn/unplugged |
124 | .yarn/build-state.yml | 127 | .yarn/build-state.yml |
125 | .yarn/install-state.gz | 128 | .yarn/install-state.gz |
126 | -.pnp.* | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
129 | +.pnp.* | ||
130 | +package-lock.json.orig | ||
131 | +package-lock_BACKUP_15197.json | ||
132 | +package-lock_BASE_15197.json | ||
133 | +package-lock_LOCAL_15197.json | ||
134 | +package-lock_REMOTE_15197.json | ||
135 | +package.json.orig | ||
136 | +readme.md.orig | ... | ... |
.vscode/launch.json
deleted
100644 → 0
1 | -{ | ||
2 | - // Use IntelliSense to learn about possible attributes. | ||
3 | - // Hover to view descriptions of existing attributes. | ||
4 | - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
5 | - "version": "0.2.0", | ||
6 | - "configurations": [ | ||
7 | - { | ||
8 | - "type": "pwa-node", | ||
9 | - "request": "launch", | ||
10 | - "name": "Launch Program", | ||
11 | - "skipFiles": [ | ||
12 | - "<node_internals>/**" | ||
13 | - ], | ||
14 | - "program": "${workspaceFolder}/Weather.js" | ||
15 | - } | ||
16 | - ] | ||
17 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -20,7 +20,7 @@ | ... | @@ -20,7 +20,7 @@ |
20 | <div align="center">현재 위도: <span id="lat"></span></div> | 20 | <div align="center">현재 위도: <span id="lat"></span></div> |
21 | <div align="center">현재 경도: <span id="lng"></span></div> | 21 | <div align="center">현재 경도: <span id="lng"></span></div> |
22 | </body> | 22 | </body> |
23 | + <script src="map.js"></script> | ||
23 | <script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script> | 24 | <script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script> |
24 | - <script src="map.js"></script> | 25 | + <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAguo3zH8vWZJbzXEqyp8D8UvnBh3zX8rQ&callback=initMap&v=weekly" async> </script> |
25 | - <script src="https://maps.googleapis.com/maps/api/js?key=APIKEY&callback=initMap&v=weekly" async> </script> | ||
26 | </html> | 26 | </html> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -2,6 +2,7 @@ | ... | @@ -2,6 +2,7 @@ |
2 | // prompted by your browser. If you see the error "The Geolocation service | 2 | // prompted by your browser. If you see the error "The Geolocation service |
3 | // failed.", it means you probably did not give permission for the browser to | 3 | // failed.", it means you probably did not give permission for the browser to |
4 | // locate you. | 4 | // locate you. |
5 | + | ||
5 | let map, infoWindow; | 6 | let map, infoWindow; |
6 | 7 | ||
7 | function initMap() { | 8 | function initMap() { |
... | @@ -31,6 +32,7 @@ function initMap() { | ... | @@ -31,6 +32,7 @@ function initMap() { |
31 | map.setCenter(pos); | 32 | map.setCenter(pos); |
32 | document.getElementById("lat").innerHTML = pos.lat; | 33 | document.getElementById("lat").innerHTML = pos.lat; |
33 | document.getElementById("lng").innerHTML = pos.lng; | 34 | document.getElementById("lng").innerHTML = pos.lng; |
35 | + // console.log(dfs_xy_conv("toXY",pos.lat,pos.lng)); | ||
34 | 36 | ||
35 | }, | 37 | }, |
36 | () => { | 38 | () => { | ... | ... |
1 | /* Always set the map height explicitly to define the size of the div | 1 | /* Always set the map height explicitly to define the size of the div |
2 | * element that contains the map. */ | 2 | * element that contains the map. */ |
3 | 3 | ||
4 | - @import url(//fonts.googleapis.com/earlyaccess/nanumgothic.css); | 4 | + @import url(http://fonts.googleapis.com/earlyaccess/nanumgothic.css); |
5 | h1 { text-align: center; } | 5 | h1 { text-align: center; } |
6 | h2 { text-align: center; } | 6 | h2 { text-align: center; } |
7 | h3 { text-align: center; } | 7 | h3 { text-align: center; } | ... | ... |
... | @@ -2,15 +2,15 @@ const request = require('request'); | ... | @@ -2,15 +2,15 @@ const request = require('request'); |
2 | const moment = require('moment'); | 2 | const moment = require('moment'); |
3 | require('moment-timezone'); | 3 | require('moment-timezone'); |
4 | moment.tz.setDefault("Asia/seoul"); | 4 | moment.tz.setDefault("Asia/seoul"); |
5 | -let today = new String(get_base_date()); | 5 | +let date = new String(get_base_date()); |
6 | let time = new String(get_base_time()); | 6 | let time = new String(get_base_time()); |
7 | var url = 'http://apis.data.go.kr/1360000/VilageFcstInfoService_2.0/getVilageFcst'; | 7 | var url = 'http://apis.data.go.kr/1360000/VilageFcstInfoService_2.0/getVilageFcst'; |
8 | -var queryParams = '?' + encodeURIComponent('serviceKey') + '=API KEY'; /* Service Key*/ | 8 | +var queryParams = '?' + encodeURIComponent('serviceKey') + '=5e8RQfsCMcXO61FvD7j5tgt5fHf0NYadkSaW6%2FhYQHdoxSgQFXbN7VSb4CI%2BW9scLv2usb3riB7UAGNF7Wb6nA%3D%3D'; /* Service Key*/ |
9 | queryParams += '&' + encodeURIComponent('pageNo') + '=' + encodeURIComponent('1'); /* */ | 9 | queryParams += '&' + encodeURIComponent('pageNo') + '=' + encodeURIComponent('1'); /* */ |
10 | queryParams += '&' + encodeURIComponent('numOfRows') + '=' + encodeURIComponent('10'); /* */ | 10 | queryParams += '&' + encodeURIComponent('numOfRows') + '=' + encodeURIComponent('10'); /* */ |
11 | queryParams += '&' + encodeURIComponent('dataType') + '=' + encodeURIComponent('JSON'); /* */ | 11 | queryParams += '&' + encodeURIComponent('dataType') + '=' + encodeURIComponent('JSON'); /* */ |
12 | -queryParams += '&' + encodeURIComponent('base_date') + '=' + encodeURIComponent(today); /* */ | 12 | +queryParams += '&' + encodeURIComponent('base_date') + '=' + encodeURIComponent(date); /* */ |
13 | -queryParams += '&' + encodeURIComponent('base_time') + '=' + encodeURIComponent('2000'); /* */ | 13 | +queryParams += '&' + encodeURIComponent('base_time') + '=' + encodeURIComponent(time); /* */ |
14 | queryParams += '&' + encodeURIComponent('nx') + '=' + encodeURIComponent('55'); /* */ | 14 | queryParams += '&' + encodeURIComponent('nx') + '=' + encodeURIComponent('55'); /* */ |
15 | queryParams += '&' + encodeURIComponent('ny') + '=' + encodeURIComponent('127'); /* */ | 15 | queryParams += '&' + encodeURIComponent('ny') + '=' + encodeURIComponent('127'); /* */ |
16 | 16 | ||
... | @@ -47,40 +47,29 @@ request({ | ... | @@ -47,40 +47,29 @@ request({ |
47 | url: url + queryParams, | 47 | url: url + queryParams, |
48 | method: 'GET' | 48 | method: 'GET' |
49 | }, function (error, response, body) { | 49 | }, function (error, response, body) { |
50 | - //console.log('Status', response.statusCode); | 50 | + console.log('Status', response.statusCode); |
51 | - //console.log('Headers', JSON.stringify(response.headers)); | 51 | + console.log('Headers', JSON.stringify(response.headers)); |
52 | console.log('Reponse received', body); | 52 | console.log('Reponse received', body); |
53 | -}); | 53 | +}); |
54 | 54 | ||
55 | - | ||
56 | - | ||
57 | - | ||
58 | -// 소스출처 : http://www.kma.go.kr/weather/forecast/digital_forecast.jsp 내부에 있음 | ||
59 | -// 기상청에서 이걸 왜 공식적으로 공개하지 않을까? | ||
60 | // | 55 | // |
61 | // (사용 예) | 56 | // (사용 예) |
62 | // var rs = dfs_xy_conv("toLL","60","127"); | 57 | // var rs = dfs_xy_conv("toLL","60","127"); |
63 | // console.log(rs.lat, rs.lng); | 58 | // console.log(rs.lat, rs.lng); |
64 | -// | ||
65 | 59 | ||
66 | - //<!-- | 60 | +dfs_xy_conv = function (code, v1, v2) { |
67 | - // | 61 | +// 소스출처 : http://www.kma.go.kr/weather/forecast/digital_forecast.jsp |
68 | - // LCC DFS 좌표변환을 위한 기초 자료 | 62 | +// LCC DFS 좌표변환 ( code : "toXY"(위경도->좌표, v1:위도, v2:경도), "toLL"(좌표->위경도,v1:x, v2:y) ) |
69 | - // | ||
70 | - var RE = 6371.00877; // 지구 반경(km) | ||
71 | - var GRID = 5.0; // 격자 간격(km) | ||
72 | - var SLAT1 = 30.0; // 투영 위도1(degree) | ||
73 | - var SLAT2 = 60.0; // 투영 위도2(degree) | ||
74 | - var OLON = 126.0; // 기준점 경도(degree) | ||
75 | - var OLAT = 38.0; // 기준점 위도(degree) | ||
76 | - var XO = 43; // 기준점 X좌표(GRID) | ||
77 | - var YO = 136; // 기1준점 Y좌표(GRID) | ||
78 | - // | ||
79 | - // LCC DFS 좌표변환 ( code : "toXY"(위경도->좌표, v1:위도, v2:경도), "toLL"(좌표->위경도,v1:x, v2:y) ) | ||
80 | - // | ||
81 | 63 | ||
64 | + var RE = 6371.00877; // 지구 반경(km) | ||
65 | + var GRID = 5.0; // 격자 간격(km) | ||
66 | + var SLAT1 = 30.0; // 투영 위도1(degree) | ||
67 | + var SLAT2 = 60.0; // 투영 위도2(degree) | ||
68 | + var OLON = 126.0; // 기준점 경도(degree) | ||
69 | + var OLAT = 38.0; // 기준점 위도(degree) | ||
70 | + var XO = 43; // 기준점 X좌표(GRID) | ||
71 | + var YO = 136; // 기1준점 Y좌표(GRID) | ||
82 | 72 | ||
83 | - function dfs_xy_conv(code, v1, v2) { | ||
84 | var DEGRAD = Math.PI / 180.0; | 73 | var DEGRAD = Math.PI / 180.0; |
85 | var RADDEG = 180.0 / Math.PI; | 74 | var RADDEG = 180.0 / Math.PI; |
86 | 75 | ... | ... |
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
1 | { | 1 | { |
2 | "dependencies": { | 2 | "dependencies": { |
3 | - "express": "^4.17.1" | 3 | + "express": "^4.17.1", |
4 | "http": "^0.0.1-security", | 4 | "http": "^0.0.1-security", |
5 | "moment": "^2.29.1", | 5 | "moment": "^2.29.1", |
6 | "moment-timezone": "^0.5.34", | 6 | "moment-timezone": "^0.5.34", |
7 | + "nodemon": "^2.0.15", | ||
7 | "request": "^2.88.2" | 8 | "request": "^2.88.2" |
8 | } | 9 | } |
9 | } | 10 | } | ... | ... |
run_server.js
0 → 100644
1 | +// 서비스 제공을 위한 html 홈페이지를 express로 구현하기 (기본적인 뼈대) | ||
2 | +var express = require('express') | ||
3 | +var app = express(); // express 선언 | ||
4 | +const port = 10000 //임의의 포트 10000 | ||
5 | + | ||
6 | +// request 와 response 라는 인자를 줘서 콜백 함수를 만든다. | ||
7 | +// localhost:port 브라우저에 res.sendFile() 내부의 파일이 띄워진다. | ||
8 | +app.use(express.static(__dirname + "/html")); | ||
9 | + | ||
10 | +app.get('/', function(req,res) { | ||
11 | + res.sendFile(__dirname + "/html/index.html") | ||
12 | +}) | ||
13 | + | ||
14 | +//임의의 포트 10000, 접속 주소 localhost:10000/ | ||
15 | +app.listen(port, function(){ | ||
16 | + console.log('서버 구동중 port : %d', port); | ||
17 | +}); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
run_sever.js
deleted
100644 → 0
1 | -// 서비스 제공을 위한 html 홈페이지를 express로 구현하기 (기본적인 뼈대) | ||
2 | -var express = require('express'), http = require('http'), path = require('path'); | ||
3 | -var bodyParser = require('body-parser'), serveStatic = require('serve-static'); | ||
4 | -var app = express(); // express 선언 | ||
5 | -const port = 10000 //임의의 포트 10000 | ||
6 | - | ||
7 | -//bodyparser를 활용하여 html 접근 가능하도록 함(app/x=www-form-urlencoded) | ||
8 | -app.use(bodyParser.urlencoded({extended:false})); | ||
9 | -//application/x=www-form-urlencoded를 app/json형태로 파싱 -> POST로 접근 가능. | ||
10 | -app.use(bodyParser.json()); | ||
11 | - | ||
12 | -app.use('/', serveStatic(path.join(__dirname,'HTML'))); | ||
13 | - | ||
14 | -//임의의 포트 10000, 접속 주소 localhost:10000/html/*.html 형태 | ||
15 | -http.createServer(app).listen(port, function(){ | ||
16 | - console.log('서버 구동중 port : %d', port); | ||
17 | -}); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
No preview for this file type
-
Please register or login to post a comment