This is a dumb application to use as template for a Golang + Gin-gonic backend app
The database structure is in db_structure.sql
The DB host and credentials should be in a file credentials.conf
(added in .gitignore) with format
db.host=localhost
db.port=3306
db.user=root
db.password=password
Run the application using
go run main.go --credentials=credentials.conf
Creates a new Character. The body for the call should be
{
"name": "character_name"
}
Retrieve all Characters. The response body should be
{
"results": [
{
"id": 1,
"name": "character_name",
"date_created": "2020-06-14T17:45:00.000Z",
"last_updated": "2020-06-14T17:45:00.000Z"
}
]
}
Retrieve the Character matching the Id. The response body should be
{
"id": 1,
"name": "character_name",
"date_created": "2020-06-14T17:45:00.000Z",
"last_updated": "2020-06-14T17:45:00.000Z"
}
Edit a Character. The body should be
{
"name": "new_character_name"
}
Delete a character. No body for response, status 410 if deleted
Retrieve a phrases from a character, only if it belongs to that character. Response body:
{
"id": 1,
"content": "phrase content",
"date_created": "2020-06-14T17:45:00.000Z",
"last_updated": "2020-06-14T17:45:00.000Z"
}
Retrieve all phrases from a character. Response body:
{
"results": [
{
"id": 1,
"content": "phrase content",
"date_created": "2020-06-14T17:45:00.000Z",
"last_updated": "2020-06-14T17:45:00.000Z"
}
]
}
Create a new phrase for a character. The body:
{
"content": "phrase content"
}
Delete a phrase matching the phrase-id, only if it belongs to the character-id. No body for response, status 410 if deleted