Skip to content

git-dru/API-GNEWS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of Contents

  1. Getting Started
  2. API KEY
  3. Usage
  4. EndPoints
  5. Built With

Getting Started

To get a local copy up and running, follow these simple steps.

Prerequisites

This is a list of things you need to have prior to installing the project.

  • Node.js
  • npm

Installation

  • git clone
https://github.com/git-dru/API-GNEWS.git
  • Navigate into the project directory:
cd API-GNEWS
  • Install the dependencies:
npm install

API KEY

You will need a GNews API key to make requests. You can obtain an API key by signing up at https://gnews.io/docs/v4#introduction.

Once you have the API key, create a .env file in the root directory of the project and add your GNews API key like so:

GNEWS_API_KEY=<your_gnews_api_key>

Replace <your_gnews_api_key> with the actual key.

USAGE

Start the server:

node index.js

Endpoints

Fetch N news articles:

GET /api/article?count=N

Search articles by keyword:

GET /api/article/search?search=SEARCH

Search articles by title:

GET /api/article/title?title=TITLE

Search articles by author:

GET /api/article/author?author=AUTHOR_NAME

All endpoints support caching, so repeated requests for the same data will not trigger additional calls to the GNews API.

Built With

  • Node.js
  • Express.js
  • Axios
  • node-cache

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published