title: Cannot Access COVID Data
body: <p>Im sure there is an issue with my app.js but I'm not sure what the logic error is. Just a bit of background, I'm new to nodeJS and decided it would be nice to play around with COVID data. </p>
  
  <p>Now I made an api call to <a href="https://disease.sh/v2/all" rel="nofollow noreferrer">https://disease.sh/v2/all</a></p>
  
  <p>which returns </p>
  
  <pre><code>{
  "updated": 1588719012878,
  "cases": 3721393,
  "todayCases": 78122,
  "deaths": 257867,
  "todayDeaths": 5626,
  "recovered": 1238537,
  "active": 2224989,
  "critical": 49319,
  "casesPerOneMillion": 477,
  "deathsPerOneMillion": 33,
  "tests": 40264726,
  "testsPerOneMillion": 5161,
  "affectedCountries": 214
  }
  </code></pre>
  
  <p>As such, I coded the following under my app.js</p>
  
  <pre><code>const express = require("express");
  const app = express();
  const https = require("https");
  
  const url = "https://disease.sh/v2/all";
  
  
  app.get("/",function(req,res){
  
    https.get(url, function(response){
      console.log(response.statusCode)
      response.on("data",function(data){
        const covidData=JSON.parse(data);
        const cases = covidData[0].cases;
        res.send("hello "+cases);
      })
    })
  
  })
  
  
  app.listen(3000,function(){
    console.log("listening at port 3000")
  })
  
  </code></pre>
  
  <p>But the error message I get on my terminal says </p>
  
  <pre><code>/Users/alfietorres/Desktop/corona/app.js:14
        const cases = covidData[0].cases;
                                   ^
  
  TypeError: Cannot read property 'cases' of undefined
      at IncomingMessage.&lt;anonymous&gt; (/Users/alfietorres/Desktop/corona/ap
  p.js:14:34)
      at IncomingMessage.emit (events.js:198:13)
      at IncomingMessage.Readable.read (_stream_readable.js:504:10)
      at flow (_stream_readable.js:973:34)
      at resume_ (_stream_readable.js:954:3)
      at process._tickCallback (internal/process/next_tick.js:63:19)
  [nodemon] app crashed - waiting for file changes before starting...
  </code></pre>