Small education app that makes string modifications by POST request to /modify. And to add a new type of modification we did not need to affect the controller and service.
In our case, you need just add it to the StringModificationTypes enumeration and create a class that implements the StringModifier interface, which describes methods modify and getType.
Returns avaliable modification types.
-
URL
/modifications
-
Method:
GET
-
Success Response:
-
Code: 200
Content:[ "UPPERCASE", "LOWERCASE", "REVERS" ]
-
Code: 200
Content:[]
-
Returns modificated string.
-
URL
/modify
-
Method:
POST
-
URL Params
None
-
Data Params
{ "sourceString": "", "modificationType": "" }
-
Success Response:
- Code: 200
Content:String
- Code: 200
-
Error Response:
-
Code: 404 Bad Request
Content:JSON
{ "timestamp": "2022-10-01T16:55:01.546+00:00", "status": 400, "error": "Bad Request", "path": "/modify" }
-