Installation
$ npm install hack-news
Usage
####Top Stories
The examples below shows how to access the IDs of the top stories on Hacker News.
var hn = require('hack-news');
hn.allTopStories( (allTheStories, error) => {
if (error) {
console.log(error);
}
console.log(allTheStories);
});
hn.allTopStories().then(stories => {console.log(stories);});
hn.numberOfTopStories(10, (numberOfStories, error) => {
if (error) {
console.log(error);
}
console.log(numberOfStories);
});
hn.numberOfTopStories(10).then(numberOfStories => {console.log(numberOfStories);});
####New Stories
The examples below shows how to access the IDs of the new stories on Hacker News.
var hn = require('hack-news');
hn.allNewStories( (allTheStories, error) => {
if (error) {
console.log(error);
}
console.log(allTheStories);
});
hn.allNewStories().then(stories => {console.log(stories);});
hn.numberOfNewStories(10, (numOfStories, error) => {
if (error) {
console.log(error);
}
console.log(numOfStories);
});
hn.numberOfNewStories(10).then(numberOfStories => {console.log(numberOfStories);});
####Ask, Show and Job Stories
The examples below shows how to access the IDs of Ask, Show and Job stories on Hacker News.
var hn = require('hack-news');
hn.askShowOrJobStories('ask', (asj, error) => {
if (error) {
console.log(error);
}
console.log(asj);
});
hn.askShowOrJobStories('show').then(asj => {console.log(asj);});
This is it for now but stay tuned I will be adding a lot more.