This repository contains APIs for basic conversion.
- 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.
- Maven: 3.6.3
- Java : 8 or above
- PostMan: 9.0.5
- Clone Repository
git clone [email protected]:sandeepm1987/Conversion.git - Build application
goto root directory (/Conversion/) mvn clean install - Run application
java -jar .\target\conversion-0.0.1-SNAPSHOT.jar - Use Postman/Browser for verification
http://localhost:8080/actuator/health (This should return status "UP")
- Download/Refer following json present under Postman directory
- Conversion.postman_collection.json
- DEV.postman_environment.json
- Open Postman
- Goto collections
- Click import button
- Select Folder where both this file is situated
- click on import
- Select Conversion from left collection panel
- Click on Run button
- 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.
- Spring Boot
- Junit5 for unit and integration testing
- Spring Loggers
- Sleuth (This is very useful for tracking complete request in logs)
- Swagger (Basic implementation)
- Actuators (For health check and Metrics information)
- Postman (For verifying end points. It also verifies test cases written in postman)
- Swagger (should be improvised)
- Security (Secure API with OAUTH2)
- Use React/Angular for testing APIs
- BDD
- Database (Populate static data (Conversion) from DB)
Please enter an issue in the repo for any questions or problems.