GithubHelp home page GithubHelp logo

rapter1990 / currencyexchange Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 4.0 2.02 MB

Currency Exchange API for Spring Boot

Java 99.49% Dockerfile 0.51%
exception-handling h2-database java resilience4j spring-boot stream spring-cache currency-exchange actuator docker

currencyexchange's Introduction

Spring Boot Currency Change API Example

Main Information

๐Ÿ“– Information

  • The purpose of the example is to handle with http get requests regarding currency exchange
  • Here is the explanation of the currency exchange example
    • Get rates from the database if the rate info is already inserted into database
    • Get rates from apilayer.com and insert its value into database and return the rate info
    • Get exchange rates by exchange request info covering base currency, target currency and lastly amount
    • Get conversion by rate id
    • Get all conversions between two dates named start date and end date

Explore Rest APIs

Method Url Description Valid Request Params Valid Path Variable
GET /v1/rate Get Rates Info
GET /v1/exchange Get Exchange Rates By Exchange Request Info Info
GET getconversion Get Conversion By Id Info
GET getconversionlist Get Conversion List Info

Valid Request Params

    http://localhost:8080/v1/rate?base=USD&target=EUR,TRY&date=2023-05-21
    
    base: USD
    target: EUR,TRY
    date: 2023-05-21
    http://localhost:8080/v1/exchange?base=USD&target=EUR,TRY&amount=100
    
    base: USD
    target: EUR
    amount: 100
    http://localhost:8080/v1/exchange?base=USD&target=EUR,TRY&amount=100
    
    base: USD
    target: EUR
    amount: 100
    http://localhost:8080/v1/conversion?startDate=2023-05-20&endDate=2023-05-22
    
    startDate: 2023-05-20
    endDate: 2023-05-22

Valid Path Variable

    http://localhost:8080/v1/conversion/17d98364-e435-40d7-a941-af535fc95065

Technologies


  • Java 17
  • Spring Boot 3.0
  • Open API Documentation
  • Restful API
  • Spring Cache
  • Actuator
  • Resilience4j
  • Lombok
  • Maven
  • Junit5
  • Mockito
  • Integration Tests
  • Docker
  • Docker Compose

Prerequisites


  • Get API KEY from apilayer.com
  • Maven or Docker

Get API KEY from apilayer.com

1 ) Open and register apilayer.com

2 ) Register Exchange Rates Data API and Get API key

Create .env and Define API key


EXCHANGE_API_API_KEY={YOUR_API_KEY}

Docker Run

The application can be built and run by the Docker engine. The Dockerfile has multistage build, so you do not need to build and run separately.

Please follow directions shown below in order to build and run the application with Docker Compose file;

$ cd currencyexchange
$ docker-compose up -d

Maven Run

To build and run the application with Maven, please follow the directions shown below;

$ cd currencyexchange
$ mvn clean install
$ mvn spring-boot:run

Swagger

You can reach the swagger-ui through the link shown below

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

Actuator

You can reach the actuator through the link shown below

    http://localhost:8080/actuator

Screenshots

Click here to show the screenshots of project

Figure 1

Figure 2

Figure 3

Figure 4

Figure 5

currencyexchange's People

Contributors

rapter1990 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.