Unofficial NPM package for wrapping Launch Library (https://launchlibrary.net)
npm install --save launchlib-js
const Launch = require('launchlib-js')
const LaunchLib = new Launch()
LaunchLib takes two parameters, a function name, and a variable, then returns the result depends on the parameters passed in.
LaunchLib.get(functionName, var).then(data => {...})
LaunchLib.get('getLaunches', '12')
.then(data => {
// do something
})
.catch(err => {
// handle error
})
The above call will return next 12 upcoming launches.
- To return the agency with an ID of 1 using
getAgencyById
LaunchLib.get('getAgencyById', '1').then(data => {{...})
- To return the agency with an abbreviation of NASA using
getAgencyByAbbr
LaunchLib.get('getAgencyByAbbr', 'NASA').then(data => {{...})
- To return the agency with a name matching "National" using
getAgenciesByName
LaunchLib.get('getAgenciesByName', 'National').then(data => {{...})
- To return the agency type with an ID of 1 using
getAgencyTypeById
LaunchLib.get('getAgencyTypeById', '1').then(data => {{...})
- To return the agency type with a name of government using
getAgencyTypeByName
LaunchLib.get('getAgencyTypeByName', 'government').then(data => {{...})
- To return the event type with an ID of 1 using
getEventTypeById
LaunchLib.get('getEventTypeById', '1').then(data => {{...})
- To return the event type with a name of info using
getEventTypeByName
LaunchLib.get('getEventTypeByName', 'info').then(data => {{...})
- To return the launch with an ID of 1028 using
getLaunchById
LaunchLib.get('getLaunchById', '1028').then(data => {{...})
- TO return the launch with a name including Falcon using
getLaunchByName
LaunchLib.get('getLaunchByName', 'falcon').then(data => {{...})
- To return the next 5 launches using
getLaunches
LaunchLib.get('getLaunches', '5').then(data => {{...})
- To return launches after August 20th, 2015 using
getLaunchesAfter
LaunchLib.get('getLaunchesAfter', '2015-08-20').then(data => {{...})
- To return launches between August 20th, 2015 and September 20th, 2015 using
getLaunchesBetween
LaunchLib.get('getLaunchesBetween', {
"startDate": "2015-08-20",
"endDate": "2015-09-20"
}).then(data => {{...})
- To return the launch event with an ID of 7 using
getLaunchEventById
LaunchLib.get('getLaunchEventById', '1').then(data => {{...})
- To return the launch status with an ID of 1 using
getLaunchStatusById
LaunchLib.get('getLaunchStatusById', '1').then(data => {{...})
- To return the launch status with a name of GO using
getLaunchStatusByName
LaunchLib.get('getLaunchStatusByName', 'GO').then(data => {{...})
- To return the location with an ID of 1 using
getLocationById
LaunchLib.get('getLocationById', '1').then(data => {{...})
- To return the location with a name of Woomera using
getLocationByName
LaunchLib.get('getLocationByName', 'woomera').then(data => {{...})
- To return the location withing the United States using
getLocationByCountryCode
LaunchLib.get('getLocationByCountryCode', 'USA').then(data => {{...})
- To return the mission with an ID of 601 using
getMissionById
LaunchLib.get('getMissionById', '601').then(data => {{...})
- To return the mission with a name of GPS using s
getMissionByName
LaunchLib.get('getMissionByName', 'GPS').then(data => {{...})
- To return the mission event with an ID of 1 using
getMissionEventById
LaunchLib.get('getMissionEventById', '1').then(data => {{...})
- To return the mission event with a mission id of 1 using
getMissionEventByParentId
LaunchLib.get('getMissionEventByParentId', '1').then(data => {{...})
- To return the mission type with an ID of 1 using
getMissionTypeById
LaunchLib.get('getMissionTypeById', '1').then(data => {{...})
- To should return the mission type with a name of Earth Science using
getMissionTypeByName
LaunchLib.get('getMissionTypeByName', 'Earth Science').then(data => {{...})
- To return the pad with an ID of 1 using
getPadById
LaunchLib.get('getPadById', '1').then(data => {{...})
- To should return pads with a name containing launch complex using
getPadTypeByName
LaunchLib.get('getPadTypeByName', 'launch complex').then(data => {{...})
- To should return pads with a location ID of 1 using
getPadTypeByLocationId
LaunchLib.get('getPadTypeByLocationId', '1').then(data => {{...})
- To return the rocket with an ID of 1 using
getRocketById
LaunchLib.get('getRocketById', '1').then(data => {{...})
- To return the rocket with a name containing Falcon using
getRocketTypeByName
LaunchLib.get('getRocketTypeByName', 'falcon').then(data => {{...})
- To return the rockets with configuration containing v1.1 using
getRocketTypeByConfigName
LaunchLib.get('getRocketTypeByConfigName', 'v1.1').then(data => {{...})
- To return the rocket event with an ID of 10 using
getRocketEventById
LaunchLib.get('getRocketEventById', '10').then(data => {{...})
- To return the launch event with a launch id of 1 using
getRocketEventByLaunchId
LaunchLib.get('getRocketEventByLaunchId', '1').then(data => {{...})
- To return the rocket family with an ID of 1 using
getRocketFamilyById
LaunchLib.get('getRocketFamilyById', '1').then(data => {{...})
Click here to see a React + Node.js exmaple of launchlib-js
LaunchLib-js is freely distributable under the terms of the MIT license.