Eunsu486

Add gitignore

1 +
2 +
3 +
4 +#API KEY
5 +.env
...\ No newline at end of file ...\ No newline at end of file
1 +var express = require('express');
2 +var router = express.Router();
3 +var request = require('request');
4 +require('dotenv').config();
5 +
6 +/* GET home page. */
7 +let GU_CODE;
8 +let ANIMAL_INFO_API_KEY = process.env.ANIMAL_API_KEY;
9 +let user_gu;
10 +let user_latitude;
11 +let user_longitude;
12 +
13 +router.get('/hospital', function (req, res) {
14 + let institute_url = 'http://api.kcisa.kr/openapi/service/rest/convergence2019/getConver03';
15 + let qs = `?KEY=${GYEONGI_API_KEY}&SIGUN_CD=${SIGUN_CODE}&Type=json`;
16 + request({
17 + url: library_url + qs,
18 + method: 'GET'
19 + }, function (err, response, body) {
20 + if (!err && res.statusCode == 200) {
21 + let library_result = JSON.parse(body);
22 + let librarys = [];
23 + for (let i = 0; i < library_result.Tbggibllbrm[1].row.length; i++) {
24 + library = library_result.Tbggibllbrm[1].row[i];
25 + if (userArea(library, 'REFINE_LOTNO_ADDR', user_target)) {
26 + librarys.push(library);
27 + }
28 + }
29 + library_grade = evalGrade(library_A, 0.5, librarys.length);
30 + request({
31 + url: institute_url + qs,
32 + method: 'GET'
33 + }, function (err, response, body) {
34 + if (!err && res.statusCode == 200) {
35 + let institute_result = JSON.parse(body);
36 + let institutes = [];
37 + for (let i = 0; i < institute_result.TninsttInstutM[1].row.length; i++) {
38 + institute = institute_result.TninsttInstutM[1].row[i];
39 + if (userArea(institute, 'REFINE_LOTNO_ADDR', user_target)) {
40 + institutes.push(institute);
41 + }
42 + }
43 + institute_grade = evalGrade(institute_A, institute_B, institutes);
44 + grade = avgGrade(library_grade, institute_grade);
45 + res.render('result', { category: 'school', librarys: librarys, institutes: institutes, userLocation: userLocation, grade: grade });
46 + }
47 + })
48 + }
49 + })
50 +});
...\ No newline at end of file ...\ No newline at end of file