/news-api

REST API serving Top News Sources based on given parameters

Primary LanguageJava

News API

Description

The API has just 1 endpoint which returns a list of top news sources names (sorted) based upon given parameters.

Data Source

News API

Available parameters

  • k

    Required

    Maximum number of records to return

  • country

    Country code of News Sources.

    Available Country Codes:

    be bg br ca ch cn co cu cz de eg fr gb gr hk hu id ie il in it jp kr lt lv ma mx my ng nl no nz ph pl pt ro rs ru sa se sg si sk th tr tw ua us ve za

    Default - All

  • category

    Category of news sources

    Available Categories:

    business entertainment general health science sports technology

    Default - All

Steps for Local Deployment

Pre-requisites

Steps

  • Create a new file src/main/resources/application-local.properties with following content.

    server.news.api.url=http://newsapi.org
    server.news.api.key=<api-key>
  • Run following command to build JAR file.

    mvn clean install
  • Run following command to build Docker image and run it as a container.

    docker-compose up --build

Note

This project was created to be submitted as an assignment, and is not one of my personal projects.