Giter VIP home page Giter VIP logo

oex-microservice's Introduction

Exchange Rates Microservice

This is a simple microservice that provides exchange rates for various currencies against USD.

Prerequisites

Setup

  1. Clone this repository
  2. Run bun install to install dependencies
  3. Copy .env.example to .env and add your Open Exchange Rates API key

Running the service

Run the service with:

bun run dev

The service will be available at http://localhost:6565.

Endpoints

  • GET /rates: Returns exchange rates for all available currencies
  • GET /rates?currency=XXX: Returns the exchange rate for a specific currency (e.g., XXX)

Running tests

Run the tests with:

bun test

backend assignment

  • Using a backend framework/language of your choice, create a simple microservice that exposes a single GET endpoint /rates which returns a response for the exchange rate of 1 USD to a list of all available currencies:
{
    "rates": [
        {
            "symbol": "AED",
            "name": "United Arab Emirates Dirham",
            "rate":  3.672538
        },
        {
            "symbol": "AFN",
            "name": "Afghan Afghani",
            "rate": 66.809999
        },
        {
            "symbol": "ALL",
            "name": "Albanian Lek",
            "rate": 125.716501
        }
        ...
    ]
}
  • Query all supported currency names and symbols using the appropriate endpoint.
  • Query the latest exchange rates for all supported currencies using the relevant endpoint.
  • Generate a combined response that includes both currency names, symbols, and their corresponding latest exchange rates.
  • Ensure that if a supported currency does not have a latest rate, it returns a null value for the rate.
  • Handle API errors by returning a 503 Service Unavailable response if the Open Exchange Rates API is unavailable or experiences an error.
  • Introduce a GET parameter to this GET endpoint (eg: /rates?currency=AED) to filter just the queried currency in the response. If the queried currency is not supported, your endpoint should return a 404 Not Found response.
{
  "rates": [
    {
      "symbol": "AED",
      "name": "United Arab Emirates Dirham",
      "rate": 3.672538
    }
  ]
}

oex-microservice's People

Contributors

aarsh21 avatar

Watchers

 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.