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