박지환

Hide authentication key

1 node_modules/ 1 node_modules/
2 -package-lock.json
...\ No newline at end of file ...\ No newline at end of file
2 +package-lock.json
3 +.env
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
14 "author": "", 14 "author": "",
15 "license": "ISC", 15 "license": "ISC",
16 "dependencies": { 16 "dependencies": {
17 + "dotenv": "^16.0.1",
17 "ejs": "^3.1.8", 18 "ejs": "^3.1.8",
18 "express": "^4.18.1", 19 "express": "^4.18.1",
19 "request": "^2.88.2", 20 "request": "^2.88.2",
......
...@@ -3,6 +3,7 @@ const app = express(); ...@@ -3,6 +3,7 @@ const app = express();
3 const request = require("request"); 3 const request = require("request");
4 const xml2js = require("xml2js"); 4 const xml2js = require("xml2js");
5 const static = require("serve-static"); 5 const static = require("serve-static");
6 +require("dotenv").config();
6 7
7 // Modify the values as needed 8 // Modify the values as needed
8 var year = "2022"; 9 var year = "2022";
...@@ -10,8 +11,7 @@ var month = "09"; ...@@ -10,8 +11,7 @@ var month = "09";
10 var operation = "getRestDeInfo"; 11 var operation = "getRestDeInfo";
11 12
12 // Do not modify the values 13 // Do not modify the values
13 -var SERVEICE_KEY = 14 +var SERVEICE_KEY = process.env.API_KEY;
14 - "qBtJy2Prw8CCnAiijUM7VkuaA9MZozHuiQI4FbEGYdUDPz4%2FM%2FuxegGjNBWK0aWQHvSslVHwIZQwNWh57WgRTA%3D%3D";
15 var url = "http://apis.data.go.kr/B090041/openapi/service/SpcdeInfoService/"; 15 var url = "http://apis.data.go.kr/B090041/openapi/service/SpcdeInfoService/";
16 var queryParams = "?" + "solYear" + "=" + year; 16 var queryParams = "?" + "solYear" + "=" + year;
17 queryParams += "&" + "solMonth" + "=" + month; 17 queryParams += "&" + "solMonth" + "=" + month;
......