윤규리

getAddress

1 +import fetch from "node-fetch";
2 +globalThis.fetch = fetch;
3 +
4 +var currAddress = new Array();
5 +function getAdddress(currQuery) {
6 + fetch('https://dapi.kakao.com/v2/local/search/address.json?' + new URLSearchParams({
7 + query: currQuery
8 + }), {
9 + method: "GET",
10 + headers: {"Authorization": "KakaoAK c14234ba46c574c73715276c5644f397"}
11 + })
12 + .then(response => response.json())
13 + .then(data => {
14 + currAddress = data.documents.map(({road_address})=>({road_address}));
15 + // console.log(currAddress)
16 + return currAddress
17 + })
18 +}
19 +
20 +function selectAddress(addressArray, number) {
21 +
22 +}
23 +
24 +function getXY() {
25 +
26 +}
27 +module.exports = {getAddress, selectAddress, getXY};
...\ No newline at end of file ...\ No newline at end of file