This is a little REST API built with GO and uses MariaDB to store data.
Packages:
- GORM
- Mux
GET /api/books
[
{
"ID": null,
"title": "",
"author": "",
"publication": "",
"UpdatedAt": "2022-12-04T00:00:00.000Z",
"CreatedAt": "2022-12-04T00:00:00.000Z"
}
]
GET /api/books/${id}
Parameter | Type | Description |
---|---|---|
id |
number |
Required. Id of book to fetch |
{
"ID": null,
"title": "",
"author": "",
"publication": "",
"UpdatedAt": "2022-12-04T00:00:00.000Z",
"CreatedAt": "2022-12-04T00:00:00.000Z"
}
POST /api/books
{
"title": "",
"author": "",
"publication": "",
}
{
"ID": null,
"title": "",
"author": "",
"publication": "",
"UpdatedAt": "2022-12-04T00:00:00.000Z",
"CreatedAt": "2022-12-04T00:00:00.000Z"
}
PUT /api/books/${id}
Parameter | Type | Description |
---|---|---|
id |
number |
Required. Id of book to fetch |
{
"title": "",
"author": "",
"publication": "",
}
{
"ID": null,
"title": "",
"author": "",
"publication": "",
"UpdatedAt": "2022-12-04T00:00:00.000Z",
"CreatedAt": "2022-12-04T00:00:00.000Z"
}
DELETE /api/books/${id}
Parameter | Type | Description |
---|---|---|
id |
number |
Required. Id of book to fetch |
{
"ID": null,
"title": "",
"author": "",
"publication": "",
"UpdatedAt": "2022-12-04T00:00:00.000Z",
"CreatedAt": "2022-12-04T00:00:00.000Z"
}
Clone the project
git clone https://github.com/gareisdev/go-books-restapi
Go to the project directory
cd go-books-restapi
Up containers
docker-compose up