ÿØÿà JFIF ` ` ÿþ
|
Server : Apache System : Linux cloud.heroica.com.br 4.18.0-553.36.1.el8_10.x86_64 #1 SMP Wed Jan 22 03:07:54 EST 2025 x86_64 User : farolpborg ( 1053) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /var/www/node_services/climaurucuia/backend/src/controllers/ |
Upload File : |
import {Request, Response} from 'express';
const WeatherController = class WeatherController {
static async Weather(req: Request, res: Response) {
const lat = req.query.lat || '-16.125276959698585'
const lon = req.query.lon || '-45.74223252673449'
const apiKey = '34076be3ff8abf241229d869f073575d';
const lang = 'pt_br'
const units = 'metric'
const url = `https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${lon}&appid=${apiKey}&lang=${lang}&units=${units}`;
fetch(url).then(async(response) => {
res.json( await response.json())
}).catch((error) => {
res.status(400);
console.log(error);
})
}
}
export default WeatherController;