Skip to content

A project written in NodeJS + Typescript to get amount of money in different currencies.

Notifications You must be signed in to change notification settings

riccardoandronaco/currency-converter

Repository files navigation

Node.js CI

How to build and run the project

Execute the application using the node and typescript installed in local machine

Requirements:

  • It's necessary that the local machine is connected to the internet.
  • Typescript installed starting from version 3.x (tsc v3.8.3 has been used for the development)
  • NodeJs installed starting from version 7 (node v12.10.0 has been used for the development)

Steps:

  • Download the entire folder as a zip file and extract it run the following commands to install dependencies
  • Launch npm command to build the project
npm run build
  • Start the application
npm run start

Execute the application using docker:

In order to install the project as a docker package the project contains a Dockerfile that contains a series of instruction to build and run the application

The commands to execute are:

  • build the docker image
docker build -t currency-converter .
  • run a container that user the builded docker image
docker run -p 3000:3000 currency-converter

the application will listen to requests at port 3000.

To try the application is necessary to perform a request with the following options (from postman or a browser)

//query parameters
interface CurrencyRequest{
    amount: number,
    src_currency: string,
    dest_currency: string
    reference_date?: string //Optional - can be omitted, in this case the latest exchange rates will be applied
}

interface CurrencyResponse {
    amount: number,
    currency: string
}
//This example will convert an amount of money equals to 15.32 EUR to USD.
http://localhost:3000/convert?amount=15.32&src_currency=USD&dest_currency=EUR&reference_date=2020-03-11

Unit tests execution

For this project I have used mocha to implement some unit tests. To execute it it's necessary to run the following command:

npm run test

About

A project written in NodeJS + Typescript to get amount of money in different currencies.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published