Socket
Socket
Sign inDemoInstall

newsapi.js

Package Overview
Dependencies
34
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    newsapi.js

A TypeScript/JS wrapper for the News API newsapi.org


Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

newsapi.js

newsapi.js is a TypeScript (and plain JS) library for newsapi.org.

How do I use this thing?

Just run:

npm install newsapi.js -s

And some examples:

const news = require("newsapi.js");

// For TypeScript: import {NewsAPIClient} from "newsapi.js"

const sources = news.getSources()
    .then(source => console.log(sources)) // Wouldn't do this if I were you
    .catch((err) => console.error(err));

const topHeadlines = news.getTopHeadlines()
    .then(headline => {
        const articles = headline.articles;
        console.log(articles[0].title);
    });

How do I contribute?

Just create a PR! Testing information is below:

How to test this library.

All the hard Mocha & TypeScript work is done for you. But you need to provide yourself a token from here: https://newsapi.org/account.

Once you have received a token, create a file at src/test/config/test.config.json with the following content:

{
    "token": "token here"
}

While replacing the string token here with your token. Then run the following:

$ npm install

and to test:

$ npm test

Licence

We abide by the MIT license.

FAQs

Last updated on 19 Sep 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc