Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Archives
Today
Total
관리 메뉴

leebom

[02-08] 노마드코더 - momentum 만들기 본문

스터디/개인스터디(유투브 드림코딩 by엘리)(주5회)

[02-08] 노마드코더 - momentum 만들기

d0201d 2020. 11. 4. 19:20

part 5 . getting the weather API

 

참고링크.

openweathermap.org/current#data

 

Current weather data - OpenWeatherMap

Access current weather data for any location on Earth including over 200,000 cities! We collect and process weather data from different sources such as global and local weather models, satellites, radars and vast network of weather stations. Data is availa

openweathermap.org

const API_KEY = "241051bf13976dd3ddf8b8d9f247255e";
const COORDS = "coords";

function getWeather(lat, lon) {
    fetch(`https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${lon}&appid=${API_KEY }&units=metric`
    ).then(function(response){    //서버로부터 데이터가 들어올때까지 기다렸!!!!!
        return response.json()  //대기상태
    }).then(function(json){
        const temperature = json.main.temp;
        const place = json.name;
        weather.innerText = `${temperature} @ ${place}`;
    })
}

 

 

(깃허브) 작업 주소 :

github.com/leebom21/basicjs

 

leebom21/basicjs

basic js. Contribute to leebom21/basicjs development by creating an account on GitHub.

github.com

 

Comments