Skip to content

12bay/airport-detection

Repository files navigation

Airport Detection

Just return the current Airport information

Development

Copy .env.example to .env and update your environment variables.

Note: You need provides your IP geolocation service provider: check the APP_DETECT_PROVIDER variable and more advance in Tech stack section

$ yarn install
$ adonis serve --dev

Production

You can deploy with Docker container or manually

Manual deploy

$ yarn install
$ yarn start

Docker deploy

$ docker run --restart=unless-stopped -p 3333:3333 -d docker.pkg.github.com/12bay/airport-detection/airport-detection

Usage

Automatically your IP geolocation

$ curl https://ap.12bay.dev
{
  "name": "Tan Son Nhat International Airport",
  "city": "Ho Chi Minh City",
  "country": "Vietnam",
  "iata": "SGN",
  "icao": "VVTS",
  "latitude": "10.8187999725",
  "longitude": "106.652000427",
  "altitude": "33",
  "timezone": "7",
  "dst": "U",
  "tz_name": "Asia/Saigon"
}

Manually with your coordinate (Recommended way)

$ curl https://ap.12bay.dev/13.2011066/108.7849624
{
  "name": "Dong Tac Airport",
  "city": "Tuy Hoa",
  "country": "Vietnam",
  "iata": "TBB",
  "icao": "VVTH",
  "latitude": "13.049599647500001",
  "longitude": "109.333999634",
  "altitude": "20",
  "timezone": "7",
  "dst": "U",
  "tz_name": "Asia/Saigon"
}

Debug

$ curl https://ap.12bay.dev/debug
{
  "ip": "27.71.207.174",
  "latitude": 10.8142,
  "longitude": 106.6438,
  "city": "Ho Chi Minh",
  "country": "Vietnam",
  "ips": []
}

Tech stack

License

MIT © Nghiep