An example of a microservice for an object called User
Uses MongoDB/Morphia as an example of data persistence within the microservice.
Returns all users
Response:
{
"status": "SUCCESS",
"data": [
{
"id": "1",
"forename": "Tom",
"surname": "Meeson",
"email": "[email protected]"
},
{
"id": "2",
"forename": "John",
"surname": "Smith",
"email": "[email protected]"
}
]
}
Adds a new user to the system
Response:
{
"status": "SUCCESS"
}
Get a specific user by their ID
Response:
{
"status": "SUCCESS",
"data":{
"id": "3",
"forename": "Bob",
"surname": "Bobby",
"email": "[email protected]"
}
}
Edit a specific user's properties
Response:
{
"status": "SUCCESS",
"data":{
"id": "3",
"forename": "Bob",
"surname": "Bobby",
"email": "[email protected]"
}
}
Deletes a specific user's data
Response:
{
"status": "SUCCESS",
"message": "user deleted"
}
Checks if a user with given ID exists
Response:
{
"status": "SUCCESS",
"message": "user exists"
}