Skip to content
This repository

Unofficial Hacker News API

branch: master
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 HNSearch API instead.

Quick Start

  1. git clone this repo.
  2. cd to repo folder.
  3. Optionally download, install and start redis.
  4. npm install
  5. node server.js
  6. Load localhost in your web browser.

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

Something went wrong with that request. Please try again.