This API helps user to compare different tariffs on their annual costs.
Comparison will accept :
Consumption (kWh/year)
Return a list of products with columns:
Tariff name
Annual costs (€/year)
Software prerequisites:
node.
-
clone the project (git clone https://github.com/prasad424jntu/tariffs.git)
Run below commands from root folder:
-
npm install
-
npm start
-
access the tariff comparison api through swagger here: http://localhost:3001/api-docs
Alternatively can directly access from a browser using the following url: http://localhost:3001/tariffs/list?annualconsumption={value}
-
run the test cases -> npm run test
-
run lint -> npm run lint
Added a basic swagger support without using too many third party libraries.
http://localhost:3001/api-docs
Test cases are written using mocha/ chai.
Linting is added. To test linting run npm run lint
Composed docker file to run the app in a container.
Prerequisites: > Need to have docker package installed (npm install docker) > Docker Desktop - Application for running containerised applications in local.
Steps to run in a container:
1) docker build -t tariffs .
2) docker run -p 3001:3001 tariffs
3) access swagger to test: http://localhost:3001/api-docs