반응형
날씨 정보가 필요할 경우 유용하게 사용할 수 있는 곳이다.
https://openweathermap.org/
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}`;
});
활용한다면 위처럼 사용할 수 있고, request에 대한 response의 예시는 다음과 같다.
반응형
'Information* > 알면도움됨' 카테고리의 다른 글
zip2john 설치 (0) | 2019.03.13 |
---|---|
PIL과 Pillow (0) | 2019.03.11 |
색 찾을 때 유용한 사이트 (0) | 2019.03.07 |
Atom syntax theme 잘 적용이 안될 때 (0) | 2019.02.25 |
Visual Studio Code 환경 세팅 (0) | 2019.02.13 |