hacker-news-api-consumer

    0.0.1 • Public • Published

    Hacker news API consumer

    Hacker news API consumer.

    Consume endpoints

    • item
    • user
    • maxitem
    • topstories
    • newstories
    • beststories
    • askstories
    • showstories
    • jobstories

    Installation

    npm install --save hacker-news-api-consumer

    Usage

    const { item, topstories } = require('hacker-news-api-consumer');
     
    // Get item
    item(121003).then(response => {
      // ...response object
    }).catch(error => {
      // ...error object
    });
     
    // Get top stories
    topstories().then(response => {
      // ...response object
    }).catch(error => {
      // ...error object
    });

    Methods

    Every method returns promise.

    • Item - item(<id:number>)
    • User - user(<id:string>)
    • Max item - maxitem()
    • Top stories - topstories()
    • New stories - newstories()
    • Best stories - beststories()
    • Ask stories - askstories()
    • Show stories - showstories()
    • Job stories - jobstories()

    Response schema

    {
      status: '<number>',
      data: '<any>'
    }

    Error schema

    {
      status: '<number>',
      error: '<string>'
    }

    Install

    npm i hacker-news-api-consumer

    DownloadsWeekly Downloads

    1

    Version

    0.0.1

    License

    MIT

    Unpacked Size

    39.3 kB

    Total Files

    26

    Last publish

    Collaborators

    • abhaydgarg