- On node server boot up, connects to mongo database
- HN aggregator module runs on database connected callback
- Fetches
maxItemId
from HN API and starts listening on theupdates
API - Find
lastProcessedItemId
from setting's collection, if not exist consider-1000
from themaxItemId
as the start item - Get snapshots of all items in between the
maxItemId
andlastProcessedItemId
- Filter the items which are just stories
- Store the stories into the database
- When done, update the
lastProcessedItemId
to themaxItemId
GET
/stories?top=10&startTime=&endTime=
- HN data timestamps are in UTC (Unix time)
- HN API endpoint queries support Unix time