Quickforex API

A NodeJs and Redis based Forex Service API

: javascript

Concepts Used

  • REST API
  • NoSQL
  • Web Framework

Features

  • Get Rates
  • Convert
  • Website and API

Code Link


Introduction

I had heard that NodeJs was a brilliant to make high concurrency applications like API.

So I set out to make a project and thought I should make a forex API.

Working

This API is made using NodeJS based web framework called Express JS.

And it used Redis as a database:

  • A sorted set “rates” for differnt currency rates in terms of USD.
  • A string “timestamp” to set date of update, updated once daily.
  • A hash to store list of currencies with their symbols for resolution.

Features

The features available are:

  • Get rates for various available currencies
  • Get symbols for various available currencies
  • Convert units from any currency to another

You can get rates by making a GET request at:

GET https://quickforex.herokuapp.com/rates

You can get the list of available currencies by:

GET https://quickforex.herokuapp.com/currencies

For example, for conversion of 2 GBP to INR you need to:

GET https://quickforex.herokuapp.com/convert/gbp/inr/2

The result is:

180.45 INR

The problem I had was with the asynchronous nature of all I/O functions, and this was a good experiment for me to learn about javascript callbacks and how async functions means.

Conclusion

This project has helped me with:

  • learning about workings of NodeJS
  • Async programming and callbacks
  • Redis DB