##Build and run App
docker-compose build
docker-compose up
##APIs
###Create an email
POST /user
- Request body
{
"Email":"abc@example.com"
}
- Response body:
{
"Success": true
}
###Create friend connection
POST /friend
- Request body:
{
"friends": [
"andy@example.com",
"john@example.com"
]
}
- Response body:
{
"success": "true"
}
GET /friend/friends
- Request body:
{
"email": "andy@example.com"
}
- Response body:
{
"success": "true",
"friends": [
"john@example.com"
],
"count" : 1
}
GET /friend/common-friends
- Request body:
{
"friends": [
"andy@example.com",
"john@example.com"
]
}
- Response body:
{
"success": "true",
"friends": [
"common@example.com"
],
"count" : 1
}
POST /subscription
- Request body:
{
"requestor": "lisa@example.com",
"target": "john@example.com"
}
- Response body:
{
"success": "true"
}
POST /block
- Request body:
{
"requestor": "andy@example.com",
"target": "john@example.com"
}
- Response body:
{
"success": "true"
}
GET /friend/emails-receive-update
- Request body:
{
"sender": "john@example.com",
"text": "Hello World! kate@example.com"
}
- Response body:
{
"success": "true",
"recipients": [
"lisa@example.com",
"kate@example.com"
]
}
-
Workflow: Request => Handlers => Services => Repositories => Database
-
Three layers model:
- Handlers: Get request from httpRequest, decode, validate, call services, write httpResponse
- Services: Handle business logic, call repositories
- Repositories: Data access layer