Skip to content

Latest commit

 

History

History
106 lines (85 loc) · 3.62 KB

README.md

File metadata and controls

106 lines (85 loc) · 3.62 KB

build

Bugs Vulnerabilities Duplicated Lines (%) Reliability Rating Maintainability Rating Security Rating Code Smells

News feed project

Getting started

Prerequisites:

  • openjdk 18
  • docker
  • maven 3.8.5

Setup:

  1. git clone <this repository>
  2. cd news-provider
  3. mvn clean install
  4. docker-compose up

The PostgreSql db will start, news-ingest spring boot application will start to fetch & save news in the database and a GraphQL Endpoint will be available at address: http://localhost:8888/v1/news

Now you can simply access the GraphQL endpoint using Postman:

And add the GraphQL query in the body:

{
    findAllNews{
        title,
        description,
        publishedDate,
        imageUrl
    }
}

NOTE: by default, a maximum of 100 articles will be retrieved!

Controling the pagination and size(default is 10):

{
    findAllNews(page: 0, size: 5){
        title,
        publishedDate,
        description
    }
}

Other examples:

{
    findAllNews(page: 1, size: 10){
        title,
        publishedDate,
        description
    }
}
{
    findAllNews{
        title,
        publishedDate
    }
}
{
    countNews
}

Or any other combination of the fields.

Project description

One Maven parent project, packing three Maven modules:

  • news-api: Spring Boot application for exposing GraphQL endpoint

  • news-commons: Holding common data between the other two modules

  • news-ingestion: Spring Boot application with Scheduling Tasks for fetching and saving data

  • News ingest application

 - Scheduling task
 - Polling news feed from: http://feeds.nos.nl/nosjournaal?format=xml
 - Frequency: 5 minutes
 - Save and update news in a relational database using Spring Data jpa
 - PostgreSql database

 Doc reference: https://spring.io/guides/gs/scheduling-tasks/

  • News feed GraphQL API

 Endpoint:
 - /v1/news

Doc reference: https://spring.io/projects/spring-graphql#learn