A simple REST API web service built on Java Spark
Here is the response format in JSON that will be returned in this service:
{
status: <STATUS>
message: <TEXT-MESSAGE>
data: <JSON-OBJECT>
}
The status field value can be either SUCCESS or ERROR.
When status is SUCCESS, the data field will contain the JSON representation of the return data, such as a User or collection of Users.
When the status is ERROR or there is no data being returned, the message field will be populated to convey a reason for the error or lack of return data.
- Java 18
- Maven 3.8.6
mvn clean package
After, you have built the program then run:
mvn exec:java -Dexec.mainClass="com.mycompany.user.UserController"
The service will be available at http://localhost:4567
Run all unit tests by: mvn test
Test in Postman:
POST /users
GET /users
GET /user/{id}


