Advertisement
jlhtkqwjha

Untitled

May 2nd, 2022
20
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const https = require('https')
  2. let url = 'https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY'
  3. https.get(url, res => {
  4.     let rawData = ''
  5.     res.on('data', chunk=> {
  6.         rawData += chunk
  7.     })
  8.     res.on('end', () => {
  9.         const parsedData = JSON.parse(rawData)
  10.         console.log(parsedData)
  11.     })
  12. }).on("error", error => {
  13.     console.log(error)
  14. })
  15.  
Advertisement
RAW Paste Data Copied
Advertisement