navigator.geolocation.getCurrentPosition()
user์ ์์น(geolocation)๋ฅผ ์ผ์ค๋ค.
์ฑ๊ณตํ์ ๋ ์คํ๋ ํจ์
์๋ฌ๊ฐ ๋ฐ์ํ์ ๋ ์คํ๋ ํจ์
API ๋?
application programming interface
ํ๋ก๊ทธ๋จ๋ค์ด ์๋ก ์ํตํ๋ ๋ฐฉ๋ฒ / ์ฝ๋๋ค๋ผ๋ฆฌ ์๋ก ์ํตํ๊ธฐ ์ํด ๋ง๋ค์ด์ง ๊ฒ
๊ณต๊ณต API
๋ ์จ API
๊ฐ ์ดํ๋ค์ API
๊ณผ๊ฑฐ ๋ ์จ API
๊ณต๊ธฐ ์ค์ผ API
API ๋ ๋ฐ์ดํฐ, ์๋ฒ๋ฅผ ๊ฐ์ง๊ณ ์๋ ์ฌ๋๋ค์ด ์ํ๋๋๋ก ๋์์ธํ ์ ์๋ค. ๊ทธ๋์ ์ด๋ค API๋ ์ ๊ทผ๊ถํ์ด ์ ํด์ ธ์๋ค. ๊ฐ๋์ API ์ฌ์ฉ์ ์ ์ฝ์ด ์๊ฑฐ๋, ์ฌ์ฉํ๊ธฐ ์ํด ์ง๋ถํด์ผํ ๋๋ ์๋ค.
web API = ๋ธ๋ผ์ฐ์ ๋ฅผ ์ํด ๋ง๋ API. ex) ๊ตฌ๊ธ ํฌ๋กฌ, ํ์ด์ดํญ์ค ๋ฑ๋ฑ
<API ๊ณ์ ์ด๊ธฐ>
ะกurrent weather and forecast - OpenWeatherMap
Leaving everything behind, people are fleeing conflict in Ukraine. They need shelter, food, and water. When you subscribe to our service, you can join us to help with donation of just of 20. Openweather will add 40 to each donation and send it to Disastrou
openweathermap.org
- ํ์๊ฐ์ ํ๊ธฐ Create New Account
- ์ํ๋ API doc ๊ฐ์ ์ฃผ์ ๋ณต์ฌํ๊ธฐ
3. https://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid={API key}
์ด ๋ถ๋ถ์ ์ํ๋ ๊ฐ์ผ๋ก ๋ฃ๊ธฐ
4. My API keys ์์ API key ๋ฃ๊ธฐ
5. ์จ๋๋ฅผ ํ์จ์์ ์ญ์จ๋ก ๋ฐ๊พธ๊ธฐ
์ฃผ์ ๋ค์ &units=metric ๋ฅผ ์ถ๊ฐํ๋ฉด ๋๋ค.
https://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid={API key}&units=metric
<์ฐธ๊ณ - API ์ค์ ์ ํธํ๊ฒ ํด์ฃผ๋ ์๋น์ค>
<ํฌ๋กฌํ์ฅ ํ๋ก๊ทธ๋จ Json viewer >
JSON Viewer
The most beautiful and customizable JSON/JSONP highlighter that your eyes have ever seen. Open source at https://goo.gl/fmphc7
chrome.google.com
์ต์ ์์ ์ํ๋ ๊ธ๊ผด, ๋ชจ์์ผ๋ก ์ค์ ๋ ๊ฐ๋ฅํด์!
๋ค์ด๋ฐ์ผ๋ฉด ์๋์ฒ๋ผ ๋ณด๊ธฐ ์ด๋ ค์ด ์ฝ๋๋ฅผ ์๋์ฒ๋ผ ๋ณด๊ธฐ ํธํ๊ฒ ๋ฐ๊ฟ์ค๋ต๋๋ค!
10๋ถ๋ ๋์ง ์๋ ๊ฐ์๋ฅผ 1์๊ฐ์ด ๋๋๋ก ๋ณด๊ณ ๋ ๋ณด๊ณ ์ดํดํ๋ฉด์ ๋ฃ๊ณ , ๋๋์ด ์ค๋ ์๊ฐํ๋ค!!
์ฌ์ค ์๊ฐ์ ํ์ง๋ง ์์ง ๋ง์ด ๋ถ์กฑํ๋ค.
ํผ์ ๋๋ง์ ํ๋ก์ ํธ๋ฅผ ์์ฑ์ํค๋ฉฐ ํ์นธ์ฉ ์ฑ์๋๊ฐ ๊ฒ์ด๋ค!
ํ์ดํ !