UNPKG

aviation-api

Version:

[![Build Status](https://travis-ci.org/cristobal-io/aviation-api.svg?branch=master)](https://travis-ci.org/cristobal-io/aviation-api)

82 lines (49 loc) 2.33 kB
# aviation-api [![Build Status](https://travis-ci.org/cristobal-io/aviation-api.svg?branch=master)](https://travis-ci.org/cristobal-io/aviation-api) This is the REST API that powers [http://aviation.cristobal.io](http://aviation.cristobal.io) ([github repo](https://github.com/cristobal-io/aviation-api/). It's built on top of [aviation-model](https://github.com/cristobal-io/aviation-model/), and uses aviation data gathered from [aviation-scrapper](https://github.com/cristobal-io/aviation-scrapper/). Check the [API docs](https://cristobal-io.github.io/aviation-api/). ## Usage ### Pre-requisites This API uses the data gathered by a [scrapper](https://github.com/cristobal-io/aviation-scrapper), the data is then [normalized and stored in JSON files](https://github.com/cristobal-io/aviation-json/) before being [migrated to a postgres database.](https://github.com/cristobal-io/aviation-pg/). Make sure you check the [migration module](https://github.com/cristobal-io/aviation-pg/) if you want to set this app on an existing postgres server. ### Docker setup All the dependencies for running the API as defined on this projects docker-compose.yml file. To bring up a local instance of the API, you just need to run. ``` make dev ``` this will start dependencies on docker and the server locally using nodemon. For continuous testing run: ``` make test-watch ``` To start the db, run and other dependencies run: ``` make docker-dependencies ``` #### Environment setup Default environment variables will be taken from .env ### Example With the server started you can enter the following URL: ```html http://localhost:8081/airlines/?airline_id=American_Airlines ``` And will have the json object returned: ```json [ { "airline_id":"American_Airlines", "name":"American Airlines, Inc.", "logo_url":"//upload.wikimedia.org/wikipedia/en/thumb/2/23/American_Airlines_logo_2013.svg/300px-American_Airlines_logo_2013.svg.png", "iata":"AA", "icao":"AAL", "callsign":"AMERICAN", "website":"http://www.aa.com" } ] ``` ## Testing Run the command `npm test` or `make test` or if you want to use docker `make test-docker` or `make test-docker-watch`. ### Contributions: If you want to contribute, create your branch and place a PR or open an issue.