The SDK for accessing all 9000+ airport codes and airport data from Air-port-codes API data feed.
npm install air-port-codes-node
Consult the documentation for the appropriate config settings to use.
Also, you can view the Ionic Angular example TypeScript file showing it in practice.
import { autocomplete } from 'air-port-codes-node';
this.apca = autocomplete({
key : 'xxxxxxxxxxx',
secret : 'xxxxxxxxxxxxxxx', // Your API Secret Key: use this if you are not connecting from a web server
limit : 15
});
For each request, typically a key press you would make the api request
this.apca.request(term);
Then simply listen for the response
// SUCCESS we found some airports
this.apca.onSuccess = (data) => {
console.log('data', data)
};
// FAIL no airports found
this.apca.onError = (data) => {
console.log('onError', data.message);
};
MIT license | (c) 2016 AIR-PORT-CODES | Air-port-codes.com/legal/terms-of-use