Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source-group1
/
animal-Info
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Eunsu486
2021-05-23 12:49:35 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
df6761abb1263a5af1f6fdfb4588c27ef10b91a4
df6761ab
1 parent
84a2b017
Add gitignore
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
0 deletions
.gitignore
routes/category.js
.gitignore
0 → 100644
View file @
df6761a
#API KEY
.env
\ No newline at end of file
routes/category.js
0 → 100644
View file @
df6761a
var
express
=
require
(
'express'
);
var
router
=
express
.
Router
();
var
request
=
require
(
'request'
);
require
(
'dotenv'
).
config
();
/* GET home page. */
let
GU_CODE
;
let
ANIMAL_INFO_API_KEY
=
process
.
env
.
ANIMAL_API_KEY
;
let
user_gu
;
let
user_latitude
;
let
user_longitude
;
router
.
get
(
'/hospital'
,
function
(
req
,
res
)
{
let
institute_url
=
'http://api.kcisa.kr/openapi/service/rest/convergence2019/getConver03'
;
let
qs
=
`?KEY=
${
GYEONGI_API_KEY
}
&SIGUN_CD=
${
SIGUN_CODE
}
&Type=json`
;
request
({
url
:
library_url
+
qs
,
method
:
'GET'
},
function
(
err
,
response
,
body
)
{
if
(
!
err
&&
res
.
statusCode
==
200
)
{
let
library_result
=
JSON
.
parse
(
body
);
let
librarys
=
[];
for
(
let
i
=
0
;
i
<
library_result
.
Tbggibllbrm
[
1
].
row
.
length
;
i
++
)
{
library
=
library_result
.
Tbggibllbrm
[
1
].
row
[
i
];
if
(
userArea
(
library
,
'REFINE_LOTNO_ADDR'
,
user_target
))
{
librarys
.
push
(
library
);
}
}
library_grade
=
evalGrade
(
library_A
,
0.5
,
librarys
.
length
);
request
({
url
:
institute_url
+
qs
,
method
:
'GET'
},
function
(
err
,
response
,
body
)
{
if
(
!
err
&&
res
.
statusCode
==
200
)
{
let
institute_result
=
JSON
.
parse
(
body
);
let
institutes
=
[];
for
(
let
i
=
0
;
i
<
institute_result
.
TninsttInstutM
[
1
].
row
.
length
;
i
++
)
{
institute
=
institute_result
.
TninsttInstutM
[
1
].
row
[
i
];
if
(
userArea
(
institute
,
'REFINE_LOTNO_ADDR'
,
user_target
))
{
institutes
.
push
(
institute
);
}
}
institute_grade
=
evalGrade
(
institute_A
,
institute_B
,
institutes
);
grade
=
avgGrade
(
library_grade
,
institute_grade
);
res
.
render
(
'result'
,
{
category
:
'school'
,
librarys
:
librarys
,
institutes
:
institutes
,
userLocation
:
userLocation
,
grade
:
grade
});
}
})
}
})
});
\ No newline at end of file
Please
register
or
login
to post a comment