Yet another unofficial API for Hacker News. Currently being used by my other project. Feel free to fork and contribute.
- API: http://node-hnapi.herokuapp.com/
- API Documentation: https://github.com/cheeaun/node-hnapi/wiki/API-Documentation
NOTE: If you are planning to scrape a huge amount of posts or (historical) data from HN, please don't use this API. Use HNSearch API instead.
git clone
this repo.cd
to repo folder.- Optionally download, install and start redis.
npm install
node server.js
- Load
localhost
in your web browser.
HNapi uses nconf for configuration, which can be done via the config.json
file, environment variables and command-line arguments.
port
- (default:80
) 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 cachingstore
- (memcached
|redis
, default: none) Specify the cache storeoptions
- Options for specified cache storeservers
-HOST:PORT
for memcached serverurl
-redis://USERNAME:PASSWORD@HOST:PORT
for redis serverdebug
- (default:false
) Allows debugging (only for redis store)
papertrail
- for logging with Papertrailhost
port
hostname
(optional) - host name for the server
universal_analytics
- for logging with Google Analytics' Universal Analytics' Measurement Protocoltid
- tracking ID
Licensed under the MIT License.