Project with Go and Neo4j.
[Go, Neo4j, Clean Architecture]
- Docker
- Docker-compose
- Go >= 1.11
- Neo4j
git clone https://github.com/larien/family-tree.git
make compose
make docker
cd backend/tests/
go test
-
URL
localhost:8899/api/v1/person
-
Method:
POST
-
URL Params
none
-
Data Params
[ { "name": "<name>", "parents": ["<parent>", "<parent>"], "children": ["<child>", "<child>"] } ]
-
Success Response:
- Code: 201 CREATED
Content:{ "message": "People registered successfully!" }
- Code: 201 CREATED
-
Error Response:
-
Description: Invalid JSON
Code: 401 Bad Request
Content:{ "message": "Failed to parse json" }
-
Description: Server error
Code: 500 Internal Server Error
Content:{ "message": "Failed to register people" }
-
-
Sample Body:
[
{
"name": "Bruce",
"parents": ["Mike", "Phoebe"]
},
{
"name": "Dunny",
"parents": ["Mike", "Phoebe"]
}
]
-
URL
localhost:8899/api/v1/person
-
Method:
GET
-
URL Params
none
-
Data Params
none
-
Success Response:
-
Code: 200 OK
Content:[ { "name": "Bruce", "parents": ["Mike", "Phoebe"], "children": null }, { "name": "Mike", "parents": null, "children": ["Bruce", "Dunny"] }, { "name": "Phoebe", "parents": null, "children": ["Bruce", "Dunny"] }, { "name": "Dunny", "parents": ["Mike", "Phoebe"], "children": null } ]
-
Code: 204 No Content
Content:{ "message": "No people were found" }
-
-
Error Response:
- Description: Server error
Code: 500 Internal Server Error
Content:{ "message": "Failed to find all people" }
- Description: Server error
-
Sample Body:
none
-
URL
localhost:8899/api/v1/person/name/:name
-
Method:
GET
-
URL Params
name: string
-
Data Params
none
-
Success Response:
-
Code: 200 OK
Content:{ "name": "Bruce", "parents": ["Mike", "Phoebe"], "children": null }
-
Code: 204 No Content
Content:{ "message": "{name} wasn't found" }
-
-
Error Response:
- Description: Server error
Code: 500 Internal Server Error
Content:{ "message": "Failed to find {name}" }
- Description: Server error
-
Sample Body:
none
-
URL
localhost:8899/api/v1/person/ascendancy/:name
-
Method:
GET
-
URL Params
name: string
-
Data Params
none
-
Success Response:
-
Code: 200 OK
Content:[ { "name": "Bruce", "parents": ["Mike", "Phoebe"], "children": null }, { "name": "Mike", "parents": ["Sonny"], "children": ["Bruce", "Dunny"] }, { "name": "Dunny", "parents": ["Mike", "Phoebe"], "children": null } ]
-
Code: 204 No Content
Content:{ "message": "{name} wasn't found" }
-
-
Error Response:
- Description: Server error
Code: 500 Internal Server Error
Content:{ "message": "Failed to find {name}'s ascendancy" }
- Description: Server error
-
Sample Body:
none
This is just to help while testing. It will clear every data.
-
URL
localhost:8899/api/v1/person/clear
-
Method:
GET
-
URL Params
none
-
Data Params
none
-
Success Response:
- Code: 200 OK
Content:{ "message": Database cleared sucessfully" }
- Code: 200 OK
-
Error Response:
- Description: Server error
Code: 500 Internal Server Error
Content:{ "message": "Failed to clear database" }
- Description: Server error
-
Sample Body:
none