This is an example golang backend application using MySQL database with clean architecture.
- Go Web Framework (gin-gonic)
- Swagger (swaggo)
- CRUD operations
- JWT for authentication
- MySQL Driver: GORM
# download the project
git clone https://github.com/aabdullahgungor/mybookcase.git
cd mybookcase
go run main.go
http://localhost:9090/api/v1
- GET localhost:9090/api/v1/books
- GET localhost:9090/api/v1/books/:id
- POST localhost:9090/api/v1/books
- PUT localhost:9090/api/v1/books
- DELETE localhost:9090/api/v1/books/:id
- ........
localhost:9090/api/v1/authors
request body:
{
"id": 8,
"name": "Yazar8"
}
response body:
{
"author_id": 8,
"message": "Author has been created"
}
localhost:9090/api/v1/books
request body:
{
"id": 8,
"name": "Kitap8",
"description": "Aciklama8",
"published_date": "2020-08-08T00:00:00Z",
"edition": 8,
"total_pages": 800,
"language": "Turkce",
"isbn": "12345678",
"image_url": "imageUrl8",
"author_id": 6,
"reader_id": 1
}
response body:
{
"book_id": 8,
"message": "Book has been created"
}
localhost:9090/api/v1/categories
request body:
{
"id": 7,
"category_name": "Kategori7"
}
response body:
{
"category_id": 7,
"message": "Category has been created"
}
localhost:9090/api/v1/publishers
request body:
{
"id": 7,
"publisher_name": "Yayinevi7"
}
response body:
{
"message": "Publisher has been created",
"publisher_id": 7
}
localhost:9090/api/v1/readers
request body:
{
"id": 3,
"name": "reader3",
"email": "reader3@hotmail.com",
"password": "123456"
}
response body:
{
"email": "reader3@hotmail.com",
"message": "Reader has been created",
"name": "reader3",
"reader_id": 3
}