Unofficial Hacker News API
JavaScript
Latest commit e8b82d6 Jan 11, 2017 @cheeaun Remove more junk
Permalink
Failed to load latest commit information.
lib Update firebase syntax Jan 11, 2017
.gitignore Ignore more files Jan 11, 2017
README.md https yo Jan 11, 2017
app.json Update app.json Aug 8, 2014
config.json.example Remove empty objects from example config JSON Oct 31, 2014
package.json Remove more junk Jan 11, 2017
server.js Remove junk code Jan 11, 2017
yarn.lock Add yarn lock Jan 11, 2017

README.md

Hacker News (unofficial) API

Yet another unofficial API for Hacker News. Currently being used by my other project. Feel free to fork and contribute.

NOTE: 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.

Deploy

Quick Start

  1. git clone this repo.
  2. cd to repo folder.
  3. Optionally download, install and start redis or memcached.
  4. yarn
  5. yarn start`
  6. Load localhost in your web browser.

Example

https://node-hnapi.herokuapp.com/news?page=3

Configuration

HNapi uses nconf for configuration, which can be done via the config.json file, environment variables and command-line arguments.

  • port - (default: 80) Server port
  • cache_exp - (default: 600) Cache expiry in seconds
  • log_referer - (default: false) Logs referers
  • log_useragent - (default: false) Logs user-agent strings
  • cache
    • memory - (default: true) Use in-memory caching
    • store - (memcached | redis, default: none) Specify the cache store
    • options - Options for specified cache store
      • servers - HOST:PORT for memcached server
      • url - redis://USERNAME:PASSWORD@HOST:PORT for redis server
      • debug - (default: false) Allows debugging (only for redis store)
  • papertrail - for logging with Papertrail
    • host
    • port
    • hostname (optional) - host name for the server
  • universal_analytics - for logging with Google Analytics' Universal Analytics' Measurement Protocol
    • tid - tracking ID

License

Licensed under the MIT License.

Other APIs