const res = await fetch('http://api.open-notify.org/iss-now.json');
const { iss_position, timestamp } = await res.json();
console.log(`ISS at ${new Date(timestamp * 1000).toISOString()}`);
console.log(`Lat: ${iss_position.latitude}, Lng: ${iss_position.longitude}`);const res = await fetch(
`https://api.nasa.gov/DONKI/CME?startDate=2024-01-01&endDate=2024-01-31&api_key=${process.env.NASA_API_KEY}`
);
const events = await res.json();
console.log(`Coronal Mass Ejections in Jan 2024: ${events.length}`);
events.slice(0, 2).forEach(e => console.log(`${e.startTime}: ${e.note?.slice(0, 80)}`));// NASA APOD (Astronomy Picture of the Day)
const res = await fetch(
`https://api.nasa.gov/planetary/apod?api_key=${process.env.NASA_API_KEY}`
);
const { date, title, url, explanation } = await res.json();
console.log(`${date} — ${title}`);
console.log(url);const res = await fetch('https://api.spacexdata.com/v4/launches/latest');
const launch = await res.json();
console.log(`Latest launch: ${launch.name} on ${new Date(launch.date_utc).toDateString()}`);
console.log(`Success: ${launch.success}`);