Hacker News (unofficial) API
Yet another unofficial API for Hacker News. Currently being used by my other project. Feel free to fork and contribute.
- API (Cloudflare CDN, faster response time): http://api.hackerwebapp.com/
- API Documentation: https://github.com/cheeaun/node-hnapi/wiki/API-Documentation
βοΈ Buy me a coffee β (server, domain & maintenance)
π§ PLEASE READ THIS π§
If you are planning to scrape a huge amount of posts or (historical) data from HN, please don't use this API. Use the official Hacker News API or HN Search API instead.
Quick Start
git clone
this repo.cd
to repo folder.- Optionally download, install and start redis.
npm i
npm start
- Load
localhost:1337
in your web browser.
Example
Configuration
HNapi uses dotenv for configuration.
PORT
- (default:1337
) Server portCACHE_EXP
- (default:600
) Cache expiry in secondsLOG_REFERER
- (default:false
) Logs referersLOG_USERAGENT
- (default:false
) Logs user-agent stringsCACHE_MEMORY
- (default:true
) Use in-memory cachingCACHE_STORE
- (redis
, default: none) Specify the cache storeCACHE_SERVER
-HOST:PORT
for Redis server
License
Licensed under the MIT License.