Project with Go and Neo4j.
[Go, Neo4j, Clean Architecture]
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:
{ "message": "People registered successfully!" }
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:
[
{
"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
}
]
{ "message": "No people were found" }
Error Response:
{ "message": "Failed to find all people" }
Sample Body:
none
URL
localhost:8899/api/v1/person/name/:name
Method:
GET
URL Params
name: string
Data Params
none
Success Response:
{
"name": "Bruce",
"parents": ["Mike", "Phoebe"],
"children": null
}
{ "message": "{name} wasn't found" }
Error Response:
{ "message": "Failed to find {name}" }
Sample Body:
none
URL
localhost:8899/api/v1/person/ascendancy/:name
Method:
GET
URL Params
name: string
Data Params
none
Success Response:
[
{
"name": "Bruce",
"parents": ["Mike", "Phoebe"],
"children": null
},
{
"name": "Mike",
"parents": ["Sonny"],
"children": ["Bruce", "Dunny"]
},
{
"name": "Dunny",
"parents": ["Mike", "Phoebe"],
"children": null
}
]
{ "message": "{name} wasn't found" }
Error Response:
{ "message": "Failed to find {name}'s ascendancy" }
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:
{ "message": Database cleared sucessfully" }
Error Response:
{ "message": "Failed to clear database" }
Sample Body:
none