Created
August 19, 2015 10:21
-
-
Save oampo/75a49034555753afb0b7 to your computer and use it in GitHub Desktop.
ISS Finder M1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var axios = require('axios'); | |
var findPassTime = function(latitude, longitude) { | |
return axios.get('http://api.open-notify.org/iss-pass.json', { | |
params: { | |
lat: latitude, | |
lon: longitude | |
} | |
}) | |
.then(function(response) { | |
return new Date(response.data.response[0].risetime * 1000); | |
}) | |
}; | |
var latitude = process.argv[2]; | |
var longitude = process.argv[3]; | |
findPassTime(latitude, longitude) | |
.then(function(date) { | |
return console.log(date); | |
}) | |
.catch(function(err) { | |
console.error(err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment