Hacker News Daily API
REST API built with TypeScript and Express for HN Daily
About
If it is not yet obvious, I am obviously a Hacker News addict. I regularly visit the site to get my daily dose of dopamine. HN Daily gives the daily top stories from Hacker News. These are nicely sorted by day, month, as well as year. This is my attempt to create a simple Express web application using TypeScript so that building bots or frontends for this will be simpler.
API Reference
Show Homepage
GET /
Parameter | Type | Description |
---|---|---|
none | none | Homepage |
Get today
GET /day
Parameter | Type | Description |
---|---|---|
none | none | Defaults to show today’s top stories |
Get specific date
GET /date/${date}
Parameter | Type | Description |
---|---|---|
date | string | Required. Date in YYYY-MM-DD format. |
Get this month
GET /month
Parameter | Type | Description |
---|---|---|
none | none | Defaults to show this month’s top stories. |
Get specific month
GET /month/${date}
Parameter | Type | Description |
---|---|---|
date | string | Required. Date in YYYY-MM format. |
Run Locally
Clone the project
git clone https://github.com/byt3h3ad/hndailyapi.git
Go to the project directory
cd hndailyapi
Install dependencies
pnpm install
Start the server
pnpm dev
Roadmap
-~~ Add month support~~
- Add year support (?)
Tech Stack
ExpressJS, Typescript.
Cheerio for manipulating and parsing HTML documents.
Usage/Examples
GET /day/2024-04-14
GET /month/2024-04