Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including node-hn-api with all npm packages installed. Try it out:

var nodeHnApi = require("node-hn-api")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

node-hn-api v1.1.0

A promise based wrapper for the Hacker News Firebase API

node-hn-api Build Status npm PRs Welcome Greenkeeper badge

A promise based wrapper for the Firebase Hacker News API

Installation

npm i node-hn-api

Usage

const hn = require('node-hn-api')
hn
  .fetchTopStories(5)
  .then(topStories => {
    //..
  })
  .catch(err => {
    console.error(err)
  })

API

fetchItem(itemId) - Fetch Hacker News Item data

Returns a promise

fetchUser(userId) - Fetch Hacker News User data

Returns a promise

fetchTopStories([numberOfStories]) - Fetch Hacker News Top Stories data

Returns a promise

numberOfStories - number

Number of records to fetch

fetchNewStories([numberOfStories]) - Fetch Hacker News New Stories data

Returns a promise

numberOfStories - number

Number of records to fetch

fetchBestStories([numberOfStories]) - Fetch Hacker News Best Stories data

Returns a promise

numberOfStories - number

Number of records to fetch

fetchAskStories([numberOfStories]) - Fetch Ask Hacker News Stories data

Returns a promise

numberOfStories - number

Number of records to fetch

fetchShowStories([numberOfStories]) - Fetch Show Hacker News Stories data

Returns a promise

numberOfStories - number

Number of records to fetch

fetchJobStories([numberOfStories]) - Fetch Hacker News Job Stories data

Returns a promise

numberOfStories - number

Number of records to fetch

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free