International Space Station

node v0.10.48
version: 2.0.1
endpointsharetweet
http://open-notify.org/ takes raw data from NASA and turns it into APIs related to space and spacecraft.
// Dependencies var Promise = require('bluebird'); var moment = require('moment'); var request = Promise.promisifyAll(require('request')); var geocode = require('notebook')('capicue/geocode/4.0.1'); // API endpoints var issNowUrl = 'http://api.open-notify.org/iss-now.json'; var issPassUrl = 'http://api.open-notify.org/iss-pass.json'; var astrosUrl = 'http://api.open-notify.org/astros.json'; 0;
Get the current position of the ISS.
function currentPosition() { return request.getAsync(issNowUrl).then(function(body) { return JSON.parse(body[1]).iss_position; }); }; 0;
Find out when the ISS will next be above you.
function nextPass(location) { return geocode.simpleLookup(location).then(function(coordinates) { var options = {lat: coordinates.lat, lon: coordinates.lng}; return request.getAsync({url: issPassUrl, qs: options}); }).then(function(passResult) { var timestamp = JSON.parse(passResult[1]).response[0].risetime; return moment.unix(timestamp).fromNow(); }); }; 0;
Find out how many people are currently in space.
function numberInSpace() { return request.getAsync(astrosUrl).then(function(response) { return JSON.parse(response[1]).number; }); }; 0;
Then find out who they are.
function peopleInSpace() { return request.getAsync(astrosUrl).then(function(response) { return JSON.parse(response[1]).people; }); }; 0;
module.exports = { currentPosition: currentPosition, nextPass: nextPass, numberInSpace: numberInSpace, peopleInSpace: peopleInSpace }; 0;
await currentPosition();
// Change this to use your location in this example var myLocation = "San Francisco, CA"; await nextPass(myLocation);
await numberInSpace();
var people = await peopleInSpace(); people.map(function(person) { return person.name + " (" + person.craft + ")"; });
Loading…

21 comments

  • posted 8 years ago by 57d86b3a53afa31400597415
    Hello World
  • posted 8 years ago by 57d9137b81f03814001dd72c
    noice
  • posted 8 years ago by 5802d4c6ac70ca0014d7801a
    wish i could could see the world from that perception
  • posted 8 years ago by ybouhjira
    hi
  • posted 7 years ago by 5827d41eca79740014170f4f
    fgdgfds
  • posted 7 years ago by 5864349dda298c00141112d4
    Cool
  • posted 7 years ago by 587faf53aabc770014e31715
    wow
  • posted 7 years ago by 589a6a68ae9e7d001447ac02
    this is insane
  • posted 7 years ago by kiwl21
    Speed up internet
  • posted 7 years ago by friedrichdsaccounty
    Awesome
  • posted 6 years ago by gxela
    Checkout the channel "World's Last Chance" on YouTube. The Earth is Flat! https://www.youtube.com/channel/UC79naBVmUyEFWNl7LA_VQDg
  • posted 6 years ago by ishwan
    awesome
  • posted 4 years ago by thecoder
    I need help lol
  • posted 2 years ago by 28443007
    mdkabir11224455@gmail.com
  • posted 2 years ago by soughman7979
    Hello World
  • posted 2 years ago by danielebarreto
    Olá
  • posted a year ago by tenggo8888
    hhehelhelhelo
  • posted a year ago by tenggo8888
    hrhhhrhhr VH
  • posted 6 months ago by symant233
    amazing
  • posted 5 months ago by nolovelies
    Here i am
  • posted 11 days ago by jeffhaji6
    , سردر نمیارم. اما چون یک تورک زبان هستم پس حتمآ از هوش بالایی برخوردارم، بزودی همه چیز را خواهم دانست

sign in to comment