Skip to content

sandeepm1987/Conversion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Conversion API

Overview

This repository contains APIs for basic conversion.

Guidelines

API is supporting following Conversions

  • Mass:
    • from/to - kilogram or pound
    • {{X}} - value to be convert
    • e.g. /convert/v1/mass/{from}/{to}/{{X}}
  • Temperature:
    • from/to - fahrenheit or celsius
    • {{X}} - value to be convert
    • /convert/v1/temperature/{from}/{to}/{{X}}
  • Discount:
    • {{X}} - Original value
    • {{X}} - Discount Percentage
    • /convert/v1/discount/{{X}}/{{Y}}
  • Digital Storage:
    • from/to - gb or mb
    • {{X}} - value to be convert
    • /convert/v1/digitalstorage/{from}/{to}/{{X}}
  • Time:
    • from/to - sec or min
    • {{X}} - value to be convert
    • /convert/v1/time/{from}/{to}/{{X}}

Note: API returns Json on success. Refer json property "result" for outcome.

Prerequisite

  • Maven: 3.6.3
  • Java : 8 or above
  • PostMan: 9.0.5

Use following steps for running the application

  1. Clone Repository
    git clone [email protected]:sandeepm1987/Conversion.git
    
  2. Build application
    goto root directory (/Conversion/)
    mvn clean install
    
  3. Run application
    java -jar .\target\conversion-0.0.1-SNAPSHOT.jar
    
  4. Use Postman/Browser for verification
    http://localhost:8080/actuator/health (This should return status "UP")
    

Use Postman

  1. Download/Refer following json present under Postman directory
    1. Conversion.postman_collection.json
    2. DEV.postman_environment.json
  2. Open Postman
  3. Goto collections
  4. Click import button
  5. Select Folder where both this file is situated
  6. click on import
  7. Select Conversion from left collection panel
  8. Click on Run button

Code Review

  • Rest controllers have been used for crating endpoints
  • Controller calls factory for calling respective services
  • Service calls helper class for evaluating conversion
  • For time being I have used EnumMap for storing all static conversions (This can be replaced by DB or REST endpoints)
  • Designed this application such that it can easily evolve with minimum code changes. (e.g. if you need to introduce new conversion, just add that entry in enummap) or change is not compatible, in thta case create new service which wont break existing functionality.

Features

Designed API with following features

  1. Spring Boot
  2. Junit5 for unit and integration testing
  3. Spring Loggers
  4. Sleuth (This is very useful for tracking complete request in logs)
  5. Swagger (Basic implementation)
  6. Actuators (For health check and Metrics information)
  7. Postman (For verifying end points. It also verifies test cases written in postman)

Future Scope

Following can be implemented in future

  1. Swagger (should be improvised)
  2. Security (Secure API with OAUTH2)
  3. Use React/Angular for testing APIs
  4. BDD
  5. Database (Populate static data (Conversion) from DB)

Support

Please enter an issue in the repo for any questions or problems.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages