오늘은 nodejs 에서 접속한 곳의 온도와 날씨를 받을 수 있는 방법을 알려드립니다.
위의 주소에 API를 신청하시구요.
위의 주소는 : https://openweathermap.org/
Сurrent weather and forecast - OpenWeatherMap
Access current weather data for any location on Earth including over 200,000 cities! The data is frequently updated based on global and local weather models, satellites, radars and vast network of weather stations. how to obtain APIs (subscriptions with di
openweathermap.org
api.openweathermap.org/data/2.5/weather?q={city name}&appid={API key}
axios.get('http://api.openweathermap.org/data/2.5/weather?q=도시&appid=apiKey').then(res=>{
console.log('axios 도시 : '+res.data);
console.log('axios 날씨 : '+res.data.weather[0].main);
console.log('temp' + (res.data.main.temp -272).toString().substr(0,3));
console.log('humidity' + res.data.main.humidity);
});
nginx nodejs express 연동 설정 하기 (0) | 2021.02.02 |
---|---|
nodejs pm2 로 프로세스 관리 (0) | 2021.01.29 |
Node.js를 이용한 접속 도시,국가, IP 정보 받아오기 (0) | 2021.01.22 |
[SEQUELIZE0004] DeprecationWarning: A boolean value was passed to options.operatorsAliases. This is a no-op with v5 and should be removed (0) | 2020.12.22 |
IntelliJ node's module 추가 설치하기 (0) | 2020.03.12 |