README

Introduction

The NewsAPI Spring Boot application uses restful web services to consume data from the "https://hacker-news.firebaseio.com/v0/newstories.json?print=pretty" Firebase API and display top stories, top comments, and past stories. It uses a cache manager that is configured with a Time-to-Live (TTL) of 15 minutes to cache data after the user hits the API.

Features

The NewsAPI Spring Boot application provides the following features:

Top stories: Displays the top ten stories that have been posted in the last 15 minutes sorted by the order of their score.

Top comments: Displays the top ten comments of a given story that has been sorted based on the number of child comments.

Past stories: Displays past stories that have been posted from the endpoint of top stories.

Cache Manager: To implement fast access of data rather fetching it and recalculating .

Requirements

The fully-fledged server uses the following:

Spring Framework Spring Boot Docker Postman

Dependencies

There are a number of third-party dependencies used in the project. Browse the Maven pom.xml file for details of libraries and versions used.

Building the project

To build the project, you will need:

Java JDK 8 or higher Maven 3.1.1 or higher Git Follow these steps to build the server:

Clone the project.
Open a terminal window and navigate to the project root directory.
Run the following command to build the server:
$ mvn clean install

Testing with Docker

Follow these steps to test the NewsAPI Spring Boot application in a Docker container:

Refer to the Dockerfile. Run the following command to create a Docker image:
$ docker build -t spring-boot-docker.jar .
Run the following command to start a Docker container:
$ docker run -p 9000:9000 spring-boot-docker.jar

Conclusion

The NewsAPI Spring Boot application is a useful tool for developers who want to consume data from the Hacker News Firebase API. With its cache manager and intuitive user interface, this application provides developers with the ability to quickly and easily access the latest news stories and comments.