Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김서연
/
Corona_Vaccination_Medical_Institution
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
3
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김서연
2021-05-20 21:44:25 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
c7f1d3b72ccd0feb2804e4ac0afcdd65d8f8a1be
c7f1d3b7
2 parents
97ff2d12
66b9289e
Merge branch 'integrated
#1
' into 'master'
Integrated
#1
See merge request
!2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
30 deletions
README.md
app.js
views/main.pug
README.md
View file @
c7f1d3b
## Topic
> 코로나 19 예방접종 의료기관 조회 웹서비스를 제공하는 프로젝트입니다.
## Member
| 김서연 | 허정용 |
| :----: | :----: |
|
[
@ksy991018
](
https://github.com/ksy991018
)
|
[
@JeongYougHeo
](
https://github.com/JeongYougHeo
)
|
~~~
# integrated#1의 branch를 clone해오기
git clone -b integrated#1 --single-branch http://khuhub.khu.ac.kr/2018103585/Corona_Vaccination_Medical_Institution.git
cd Corona_Vaccination_Medical_Institution
# 본인 이름으로 각자 branch 생성 후 올리기
git checkout -b integrated#1_이름
git add .
git commit -m "커밋메시지"
git push origin integrated#1_이름
~~~
\ No newline at end of file
...
...
app.js
View file @
c7f1d3b
...
...
@@ -9,37 +9,46 @@ app.set('views','./views')
app
.
set
(
'view engine'
,
'pug'
);
app
.
use
(
express
.
static
(
'public'
));
//?page=페이지번호&?perPage=페이지당 데이터수
const
$base_url
=
`https://api.odcloud.kr/api/apnmOrg/v1/list`
;
const
$key
=
'4US0H%2BXj%2BmS8IR4YL0%2BUb9H4CcbTr92QxhYULfOEz1DT%2BZaaos4sRfNh6cmAD2Icli862Ysc31%2BaE4pWywDBIA%3D%3D'
;
//임시
const
$page
=
1
;
const
$perPage
=
1
0
;
const
$perPage
=
3000
0
;
const
$api_url
=
$base_url
+
'?
returnType=XML&
serviceKey='
+
$key
+
'&page='
+
$page
+
'&perPage='
+
$perPage
;
const
$api_url
=
$base_url
+
'?serviceKey='
+
$key
+
'&page='
+
$page
+
'&perPage='
+
$perPage
;
console
.
log
(
$api_url
);
//해당 URL로 요청
app
.
post
(
'/'
,
function
(
req
,
res
,
next
){
const
searchWord
=
req
.
body
.
region
;
//지역 키워드
request
(
$api_url
,
function
(
err
,
response
,
body
){
if
(
err
)
throw
err
;
//data부분만 추출
var
obj
=
JSON
.
parse
(
body
).
data
;
// console.log(obj);
//검색한 지역 포함한 모든 data 담기
let
searchList
=
obj
.
filter
(
searchList
=>
{
return
searchList
.
orgZipaddr
.
includes
(
searchWord
);
});
// console.log(searchList);
//result라는 변수에 담아 결과 보내기
res
.
render
(
'main'
,
{
result
:
searchList
});
})
})
app
.
listen
(
3000
,
function
(){
console
.
log
(
'Connected 3000 port!'
);
});
request
(
$api_url
,
function
(
err
,
res
,
body
){
$
=
cheerio
.
load
(
body
);
const
$infoList
=
$
(
'item'
)
console
.
log
(
$infoList
.
html
());
console
.
log
(
$infoList
.
length
);
// let name = $infoList.find('orgnm').text();
// let location = $infoList.find('orgZipaddr').text();
// console.log(`기관명: ${name}, 위치: ${location}`);
})
app
.
post
(
'/search'
,
function
(
req
,
res
){
res
.
send
(
'내가 검색한 지역은 '
+
req
.
body
.
region
);
})
app
.
get
(
'/'
,
function
(
req
,
res
){
res
.
render
(
'main'
);
})
\ No newline at end of file
...
...
views/main.pug
View file @
c7f1d3b
...
...
@@ -2,8 +2,37 @@ html
head
meta(charset='utf-8')
body
form(action='/search' method="post")
p
input(type='text' name='region' placeholder='지역')
p
input(type='submit')
\ No newline at end of file
h1 COVID-19 의료기관 검색하기
form(action='/' method="post")
p
input(type='text' name='region' placeholder='서울시')
input(type='submit')
//result값 있을때만
if result!=NULL
table
tr
th 기관명
th 기관 전화번호
th 기관 주소
th 휴무일 여부
th 점심 시작시간
th 점심 종료시간
th 진료 시작기간
th 진료 종료시간
-for(i=1; i<result.length; i++)
tr
td= result[i].orgnm
td= result[i].orgTlno
td= result[i].orgZipaddr
td= result[i].hldyYn
td= result[i].lunchSttTm
td= result[i].lunchEndTm
td= result[i].sttTm
td= result[i].endTm
\ No newline at end of file
...
...
Please
register
or
login
to post a comment