This project is a React application that demonstrates the usage of the airport-data-js
library. It allows users to search for airport information using IATA codes.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Before you begin, ensure you have met the following requirements:
- You have installed Node.js and npm/yarn.
- You have a basic understanding of React.js.
To install the Airport Data React Sample, follow these steps:
- Clone the repository or download the ZIP file to your local machine.
- Navigate to the project directory.
- Install the dependencies using npm or yarn:
npm install
To start the development server, use the following command:
npm start
This command runs the app in development mode. Open http://localhost:3000 to view it in the browser. The page will reload if you make edits.
In the React application, you can import the library as follows:
import { getAirportByIata, getAirportByIcao, getAirportByCityCode } from 'airport-data-js';
Fetching Data You can use the available methods to fetch airport data:
By IATA Code:
const dataByIata = await getAirportByIata('MAA');
console.log(dataByIata);
By ICAO Code:
const dataByIcao = await getAirportByIcao('VOMM');
console.log(dataByIcao);
By City Code:
const dataByCity = await getAirportByCityCode('NYC');
console.log(dataByCity);
To run the tests for the application, use the following command:
npm test
This command launches the test runner in the interactive watch mode.
To contribute to the Airport Data React Sample, follow these steps:
- Fork this repository.
- Create a new branch:
git checkout -b <branch_name>
. - Make your changes and commit them:
git commit -m '<commit_message>'
. - Push to the original branch:
git push origin <project_name>/<location>
. - Create the pull request.