hacker-news-api

JavaScript wrapper for the official Hacker News API

npm package

Usage

$ npm install --save @moondef/hacker-news-api

or

$ yarn add @moondef/hacker-news-api
const hk = require('@moondef/hacker-news-api');

(async () => {
  const popular = await hk.getPopular(); // you will get IDs of popular news
  const newsItem = await hk.getItem(popular[0]);

  console.log(newsItem);
})();

Methods

- getPopular() // Array
- getUser(nickname) // Object
- getItem(id) // Object
- getMaxItem() // Number
- getAskStories() // Array
- getShowStories() // Array
- getJobStories() // Array
- getUpdates() // Object
- getNewStories() // Array
- getTopStories() // Array
- getBestStories() // Array