Giter Site home page Giter Site logo

cpi's Introduction

CPI value

A Web Service in SpringBoot that provides the CPI value

This Spring Boot application provides a web service that retrieves Consumer Price Index (CPI) values and notes for a specified month and year. The service calls the Bureau of Labor Statistics (BLS) API to get the real CPI data and caches the results in an H2 database for subsequent requests. This ensures the application stays within the API call limit.

branch main implemented with H2 in memory db
and branch  cache-manager is implemented with Spring [CacheManager](https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/cache/CacheManager.html) It is not completed yet!

Implementation Logic

  • Validates input
  • Checks if there is a CIS data in the local-cache-db for the given year and month saved in the last 24 hrs
  • If there is recent CIS data, it presents that data to the client.
  • If there is no recent data, it requests the external BLS-WEB-SERVICE. It then saves the response in the local-cache-db for future reuests. And, also serves the request

Building from source

Build the JAR file: Open a terminal or command prompt, navigate to the root directory of your project (where the build.gradle file is located), and run:

gradle clean build

This command will compile your code, run tests, and package your application into a JAR file. The JAR file will be located in the build/libs directory by default.

Locate the JAR file: After the build completes, you can find the JAR file in the build/libs directory of your project. It will be named something like your-application-name-version.jar.

Running the JAR File To run the JAR file, use the java -jar command:

java -jar libs/CPI-0.0.1-SNAPSHOT.jar

A pre-built jar can be downloaded here.

Accessing the service:

You can use the embedded swagger api docs:

http://localhost:8090/swagger-ui/index.html

Swagger API DOcs

As port 8080 may be used by most servlet containers, the default port is moved to 8090. You can, however, change the port by updating the value of server.port in the application.properties file

server.port=8090

And you can run it

{localhost-or-ip}:{your-port}

If you want to change the port

Tech stack

This sample uses a these open source libs:

Dillinger is currently extended with the following plugins. Instructions on how to use them in your own application are linked below.

Plugin README
Swagger Swagger Documentation
Gradle Gradle Documentation
Gson Gson GitHub
H2 Database H2 Database Documentation

Reference Documentation

For further reference, please consider the following sections:

Guides

The following guides illustrate how to use some features concretely:

Additional Links

These additional references should also help you:

cpi's People

Contributors

mekete avatar

Watchers

 avatar

Forkers

mattlam-uw

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.