Skip to content

nycflights18 based streaming API of scheduled departures

Notifications You must be signed in to change notification settings

jveres/flights-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flights-service

This demo service makes use of the Airlines On-Time Performance public dataset provided by Bureau of Transportation Statistics.

Bundle, compress and compile source into x86_64 Linux binary:

deno bundle --unstable httpserver.ts httpserver.js
terser --compress --mangle --output httpserver.min.js -- httpserver.js  
deno compile --unstable -A --no-check --target x86_64-unknown-linux-gnu --output flights-x86_64-unknown-linux-gnu httpserver.min.js

Build and run as container image:

docker build --platform linux/amd64 -t flights-service . 
docker run --platform linux/amd64 -p 7999:7999 flights-service

Available APIs

Returns a test HTML page. Useful for checking if everything works as expected.

Query parameters:

- last-known-id=[number]

Returns daily schedule as json data.

Query parameters:

- last-known-id=[number]

Returns daily schedule in the form of server sent events. Updates are streaming realtime.

SQL schema

CREATE TABLE flights (ID INTEGER PRIMARY KEY, FL_DATE DATE, ORIGIN TEXT, ORIGIN_CITY_NAME TEXT, DEST TEXT, DEST_CITY_NAME TEXT, CRS_DEP_TIME TEXT, DEP_TIME TEXT, DEP_DELAY TEXT, CRS_ARR_TIME TEXT, ARR_TIME INTEGER, ARR_DELAY INTEGER, TAIL_NUM TEXT, OP_CARRIER TEXT, OP_CARRIER_FL_NUM TEXT);