Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

188
Views
Why Is My API Response Not Automatically Being Logged To My Terminal Console?

I'm just starting to delve into Api's via a course and essentially I am trying to pull in data from the open weather api for London. It's working IF i manually request it to console log the response via terminal (I'm on MAC) but not doing so automatically, even though it's referenced in the code. I'll paste my code below but remove my api key for obvious reasons.

Any help would be appreciated, thanks in advance for your time.

const express = require('express');
const https = require('https');
const app = express();
const port = 3000;
const url = 'https://api.openweathermap.org/data/2.5/weather?q=London&appid=12345mykeyexample'; 

//set route as index.html
app.get('/', (req, res) => {
  res.sendFile(__dirname + '/index.html');
  
  //get api url and console log response
  https.get(url, function(response){
    console.log(response);
  });
  res.send('server is up and running bro');
});


// listen on port 3000
app.listen(port, () => {
  console.log(`Server started bro http://localhost:${port}`);
}); 
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!