Code Monkey home page Code Monkey logo

currency-exchange's Introduction

Currency Exchange Service

A simple RESTful service implemented using Node.js, Fastify, and PostgreSQL to fetch and serve currency exchange rates.

Features:

RESTful API endpoints to retrieve all currencies and individual currency by ID. Automatic updating of currency exchange rates from the National Bank of Kazakhstan. Authentication via bearer token. Written in TypeScript for type safety. Dockerized for easy setup and deployment.

Prerequisites:

  • Node.js
  • PostgreSQL
  • Docker & Docker Compose (optional)

Getting Started:

Setup Environment Variables: Copy the .env.example to .env and update the variables as needed.

Install Dependencies:

Run npm install

Run the Application:

Without Docker:

Start your PostgreSQL database. Run the application using npm start.

With Docker:

Start both the application and PostgreSQL using docker-compose up.

Fetch Latest Currency Rates:

Run npm run command fetch to fetch and update the currency rates in the database.

Access the API:

Use endpoints:

GET /currencies to fetch all currencies. GET /currency/:id to fetch a specific currency by its ID.

Running Tests:

Ensure that the test database is specified in the .env file.

Run npm test.

API Authentication:

Access to the API is secured using bearer token authentication. Include your token in the Authorization header of your requests.

curl --location 'http://localhost:3000/currencies' \
--header 'Authorization: Bearer some_secret_key'

currency-exchange's People

Contributors

baitur 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.