This is an API where you can manage friends, add, remove, block, etc.
- Spring Boot
- Spring JPA
- Spring MVC
- Swagger
- dev - h2 (embedded)
- prod - MySQL
Open the project with your preferred IDE
To build execute the following command:
./mvnw clean install
To run execute the following command:
./mvnw spring-boot:run
To run the project in production mode, execute the following command:
./mvnw spring-boot:run -Dspring.profiles.active=prod
This is already deployed to Cloud Foundry, deployed database is still h2 to save cost
Open https://friend-management.cfapps.io/swagger-ui.html to access the Swagger UI
docker build -t friend-management .
docker-compose -f src/main/docker/app.yml up -d
Create a friend connection between two email addresses
- Input:
{
"friends": [ "andy@example.com", "john@example.com" ]
}
- Output:
Status: 200
{
"success": true
}
Retrieve the friends list for an email address
- Input:
{
"email": "john@example.com"
}
- Output:
Status: 200
{
"friends": [
"andy@example.com"
],
"count": "1",
"success": true
}
Retrieve the common friends list between two email addresses
- Input:
{
"friends": [ "andy@example.com", "john@example.com" ]
}
- Output:
Status: 200
{
"friends": [
"jessy@example.com"
],
"count": "1",
"success": true
}
Subscribe to updates from an email address
- Input:
{
"requestor": "andy@example.com",
"target": "john@example.com"
}
- Output:
Status: 200
{
"success": true
}
Unsubscribe to updates from an email address
- Input:
{
"requestor": "andy@example.com",
"target": "john@example.com"
}
- Output:
Status: 200
{
"success": true
}
Block updates from an email address
- Input:
{
"requestor": "andy@example.com",
"target": "john@example.com"
}
- Output:
Status: 200
{
"success": true
}
Unblock updates from an email address
- Input:
{
"requestor": "andy@example.com",
"target": "john@example.com"
}
- Output:
Status: 200
{
"success": true
}
Retrieve all email addresses that can receive updates from an email address
- Input:
{
"requestor": "andy@example.com",
"target": "john@example.com"
}
- Output:
Status: 200
{
"success": true
}
Any errors in cannot handle will return the following:
- Status: 500
{
"errorMessage": "An internal error occurred, kindly email the admins"
}