1.1.1 • Published 6 years ago
airport-data-api-wrapper v1.1.1
airport-data-api-wrapper
- An Airport-data.com API wrapper for Node or Browser.
- Be familiar with Airport-data.com's API.
- Use it in the browser globally on window, with require, or with AMD.
- See browser limitations if using in the browser.
Usage
import AirportDataApiWrapper from 'airport-data-api-wrapper'
import fetch from 'node-fetch'
const aiportData = new AirportDataApiWrapper({fetch})
airportData.acThumb('n1180m').then(res => console.log(res))
airportData.airportInfo('kcrg').then(res => console.log(res))
API
new AirportDataApiWrapper([options])
options
An object of options.
Constructor Options
fetch
If a fetch method isn't globally available as it would be in browser, pass node-fetch in here.responseHandler
You can override the method that handles the first Promise returned by the fetch. You might want to get back info from the headers such as rate limit info.
const responseHandler = (res) => res.body
const airportData = new AirportDataApiWrapper({fetch,responseHandler})
acThumb(registration[,options])
registration
An aircraft registration if passed as a string. Options if passed as an object.options
Other options as an object. See Airport-Data.com API reference
airportInfo(icao[,options])
icao
An ICAO identifier as a string. Options if given an object.options
Other options as an object. See Airport-Data.com API reference
Browser Limitations
- Requires window.fetch or fetch polyfill
- Requires support for Promises
- Airport-data.com currently only serves over HTTP. Unless they start serving over HTTPS, this library will only function in-browser over HTTP.