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-22 16:19:06 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
12d5b88e6a79a27765514f2f4396362c90d480bf
12d5b88e
2 parents
d1ad0633
94b4f4db
Merge branch 'integrated_2_ksy' into 'integrated
#2
'
Integrated 2 ksy See merge request
!6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
40 deletions
app.js
app2.js
map/kakaomap.html
map/map.html
app.js
View file @
12d5b88
...
...
@@ -8,6 +8,8 @@ app.locals.pretty=true;
app
.
set
(
'views'
,
'./views'
)
app
.
set
(
'view engine'
,
'pug'
);
app
.
use
(
express
.
static
(
'public'
));
var
http
=
require
(
'http'
);
var
fs
=
require
(
'fs'
);
//?page=페이지번호&?perPage=페이지당 데이터수
const
$base_url
=
`https://api.odcloud.kr/api/apnmOrg/v1/list`
;
...
...
@@ -35,17 +37,28 @@ app.post('/',function(req,res,next){
// console.log(searchList);
//result라는 변수에 담아 결과 보내기
res
.
render
(
'main'
,
{
result
:
searchList
});
res
.
render
(
'main'
,
{
result
:
searchList
});
})
})
app
.
get
(
'/'
,
function
(
req
,
res
){
res
.
writeHead
(
200
,
{
'Content-Type'
:
'text/html'
});
fs
.
readFile
(
'./map/kakaomap.html'
,
null
,
function
(
err
,
data
){
if
(
err
){
res
.
writeHead
(
404
);
res
.
write
(
'error'
);
}
else
{
console
.
log
(
'complete!'
);
res
.
write
(
data
);
}
res
.
end
();
});
})
app
.
listen
(
3000
,
function
(){
console
.
log
(
'Connected 3000 port!'
);
});
app
.
get
(
'/'
,
function
(
req
,
res
){
res
.
render
(
'main'
);
})
...
...
app2.js
deleted
100644 → 0
View file @
d1ad063
var
http
=
require
(
'http'
);
var
fs
=
require
(
'fs'
);
function
onRequest
(
req
,
res
){
res
.
writeHead
(
200
,
{
'Content-Type'
:
'text/html'
});
fs
.
readFile
(
'./map/map.html'
,
null
,
function
(
err
,
data
){
if
(
err
){
res
.
writeHead
(
404
);
res
.
write
(
'error'
);
}
else
{
console
.
log
(
'complete!'
);
res
.
write
(
data
);
}
res
.
end
();
});
}
http
.
createServer
(
onRequest
).
listen
(
3000
);
\ No newline at end of file
map/kakaomap.html
View file @
12d5b88
...
...
@@ -6,6 +6,13 @@
</head>
<body>
<h1>
COVID-19 의료기관 검색하기
</h1>
<form
action=
"/"
method=
"post"
>
<p>
<input
type=
"text"
name=
"region"
placeholder=
"서울시"
/>
<input
type=
"submit"
/>
</p>
</form>
<div
id=
"map"
style=
"width:700px;height:400px;"
></div>
<script
type=
"text/javascript"
src=
"https://dapi.kakao.com/v2/maps/sdk.js?appkey=35fccf4b4e2a3179187346f26ed3f988"
></script>
...
...
map/map.html
View file @
12d5b88
...
...
@@ -6,26 +6,59 @@
</head>
<body>
<h1>
COVID-19 의료기관 검색하기
</h1>
<form
action=
"/"
method=
"post"
>
<p>
<input
type=
"text"
name=
"region"
placeholder=
"서울시"
/>
<input
type=
"submit"
/>
</p>
</form>
<div
id=
"map"
style=
"width: 700px;height:400px;"
></div>
<script
type=
"text/javascript"
src=
"https://dapi.kakao.com/v2/maps/sdk.js?appkey=35fccf4b4e2a3179187346f26ed3f988&libraries=services"
></script>
<script>
var
mapContainer
=
document
.
getElementById
(
'map'
),
// 지도를 표시할 div
mapOption
=
{
center
:
new
kakao
.
maps
.
LatLng
(
33.450701
,
126.570667
),
// 지도의 중심좌표
level
:
3
// 지도의 확대 레벨
};
<script
type=
"text/javascript"
src=
"https://dapi.kakao.com/v2/maps/sdk.js?appkey=35fccf4b4e2a3179187346f26ed3f988&libraries=services"
></script>
<script>
var
mapContainer
=
document
.
getElementById
(
'map'
),
// 지도를 표시할 div
mapOption
=
{
center
:
new
kakao
.
maps
.
LatLng
(
33.450701
,
126.570667
),
// 지도의 중심좌표
level
:
3
// 지도의 확대 레벨
};
// 지도를 생성합니다
var
map
=
new
kakao
.
maps
.
Map
(
mapContainer
,
mapOption
);
// 주소-좌표 변환 객체를 생성합니다
var
geocoder
=
new
kakao
.
maps
.
services
.
Geocoder
();
// 주소로 좌표를 검색합니다
geocoder
.
addressSearch
(
'서울특별시 강동구 올림픽로 779'
,
function
(
result
,
status
)
{
// 정상적으로 검색이 완료됐으면
if
(
status
===
kakao
.
maps
.
services
.
Status
.
OK
)
{
var
coords
=
new
kakao
.
maps
.
LatLng
(
result
[
0
].
y
,
result
[
0
].
x
);
// 지도를 생성합니다
var
map
=
new
kakao
.
maps
.
Map
(
mapContainer
,
mapOption
);
// 결과값으로 받은 위치를 마커로 표시합니다
var
marker
=
new
kakao
.
maps
.
Marker
({
map
:
map
,
position
:
coords
});
// 주소-좌표 변환 객체를 생성합니다
var
geocoder
=
new
kakao
.
maps
.
services
.
Geocoder
();
// 인포윈도우로 장소에 대한 설명을 표시합니다
var
infowindow
=
new
kakao
.
maps
.
InfoWindow
({
content
:
'<div style="width:150px;text-align:center;padding:6px 0;">기관명</div>'
});
infowindow
.
open
(
map
,
marker
);
// 주소로 좌표를 검색합니다
geocoder
.
addressSearch
(
'경희대로26'
,
function
(
result
,
status
)
{
// 지도의 중심을 결과값으로 받은 위치로 이동시킵니다
map
.
setCenter
(
coords
);
}
});
geocoder
.
addressSearch
(
'서울특별시 동대문구 회기로 173'
,
function
(
result
,
status
)
{
// 정상적으로 검색이 완료됐으면
if
(
status
===
kakao
.
maps
.
services
.
Status
.
OK
)
{
if
(
status
===
kakao
.
maps
.
services
.
Status
.
OK
)
{
var
coords
=
new
kakao
.
maps
.
LatLng
(
result
[
0
].
y
,
result
[
0
].
x
);
...
...
@@ -44,7 +77,7 @@ geocoder.addressSearch('경희대로26', function(result, status) {
// 지도의 중심을 결과값으로 받은 위치로 이동시킵니다
map
.
setCenter
(
coords
);
}
});
</script>
});
</script>
</body>
</html>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment