Creating a weather app using node.js and the OpenWeatherMap API

let request = require('request');let apiKey = '34ef108283d61ecbca72455a49a8d6b2';let cidade = 'Guarda';let url = `http://api.openweathermap.org/data/2.5/weather?q=${cidade}&appid=${apiKey}&units=metric`request(url, function (err, response, body) {if(err){console.log('error:', error);} else {let weather = JSON.parse(body);let dados = `DADOS METEROLÓGICO PARA a ${weather.name}:------------- Temperatura (ºC): ${weather.main.feels_like}- Humidade: ${weather.main.humidity}- Visibilidade: ${weather.visibility}- Vento (km/h): ${weather.wind.speed}`console.log(dados);}});
node index.js

--

--

--

Finalist student in Computer Engineering

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Component Library( Vue 3 + Rollup)

What’s New in RxJS 7

RxJS 7

Loops du jour

I Almost Gave Up Becoming A Programmer, But I’m Glad I Didn’t

Redux without State

Gray Area on When to use Different Rendering Modes CSR, SSR, SSG

When to use SPA, SSR and SSG

Add a Simple Search Function to React App without a Server

How to Build Fast Static Site with Nuxt.JS and Prismic

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Afonso Antunes

Afonso Antunes

Finalist student in Computer Engineering

More from Medium

Create a nest js project from scratch (manually)

Learn Nest Js

Introduction to NodeJS

How to set up CI/CD pipelines using React, GitHub Actions, and Heroku

Why Should I Use Node.js?