AIRPORTSD(8)							  AIRPORTSD(8)



1mNAME0m
       airportsd - IATA airport code lookup server

1mSYNOPSIS0m
       airportsd [-v]

1mDESCRIPTION0m
       4mairportsd24m  is  an  HTTP-accessible IATA airport code lookup daemon.	 We
       created this as a service students can use on lab machines for develop-
       ing an Ansible lookup plugin during course.

       When  running on a 4mtty24m the program will output brief debugging informa-
       tion on startup, and when it's queried.

       The (currently hard-coded) 4mCDB24m database must exist and be  readable	 by
       the owner of the 4mairportsd24m process.

1mEXAMPLE0m
	      $ curl -i http://127.0.0.1:8812/lookup?iata=bcn
	      HTTP/1.1 200 OK
	      Connection: Keep-Alive
	      Content-Length: 166
	      Content-Type: application/json
	      Date: Fri, 02 Oct 2020 09:49:30 GMT
	      {
		"id": "4004",
		"iata": "BCN",
		"cc": "ES",
		"city": "Barcelona",
		"lat": "41.2971",
		"lon": "2.07846",
		"name": "Barcelona International Airport",
		"type": "large_airport"
	      }

1mENDPOINTS0m
       All 4mairportsd24m API endpoints are obtained via GET requests.

   1mlookup0m
       This  endpoint  expects	1miata	22mquery  parameter with a case insensitive
       3-letter IATA airport code; the key is looked up in  the	 database  and
       the JSON data or HTTP status code 404 are returned.

1mOPTIONS0m
       4mairportsd24m understands the following global options.

       -v     show version information and exit

1mENVIRONMENT0m
       1mAIRPORTSD_IP0m
	      optionally  sets	the  listen address for 4mairportsd24m; defaults to
	      1m127.0.0.1 22mand we strongly recommend this is not changed to  any-
	      thing other than a loopback address.

       1mAIRPORTSD_PORT0m
	      optionally  sets the TCP listen port to something other than the
	      default 1m881222m.

1mFILES0m
       1m/usr/local/share/airports.cdb0m
	      the database file to query.

1mREQUIREMENTS0m
   1mfreebsd0m
	      $ pkg install libmicrohttpd tinycdb

	      $ cat > config.mk <<EOF
	      DBNAME= "/usr/local/share/airports.cdb"
	      LISTEN_HOST=   "127.0.0.1"
	      LISTEN_PORT=   "8812"
	      INC =	      -I/usr/local/include
	      LIBS =	      -L /usr/local/lib
	      EOF

   1mrhel/centos0m
	      yum install tinycdb

   1mdebian0m
	      apt-get install tinycdb

   1mmacos0m
	      brew install libmicrohttpd tinycdb

   1mall0m
       o libmicrohttpd (https://www.gnu.org/software/libmicrohttpd/)

       o tinycdb (http://www.corpit.ru/mjt/tinycdb.html)

1mCREDITS0m
       o Airport data gratefully put into the Public Domain by ourairports.com
	 (https://ourairports.com/data/).

1mAVAILABILITY0m
       <https://github.com/jpmens/airportsd>

1mAUTHOR0m
       Jan-Piet Mens <https://jpmens.net>



User Manuals							  AIRPORTSD(8)
