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
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.
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.
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
Licensed under the MIT License.