맹주환

Update run_server.js settings to show html and .gitignore to ignore .vscode folder

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