https://github.com/lucasfrancaid/go-api
API developed with Go, Gin Gonic, Gorm, PostgreSQL and Docker.
https://github.com/lucasfrancaid/go-api
api docker docker-compose gin-gonic go go-api golang gorm makefile
Last synced: 10 months ago
JSON representation
API developed with Go, Gin Gonic, Gorm, PostgreSQL and Docker.
- Host: GitHub
- URL: https://github.com/lucasfrancaid/go-api
- Owner: lucasfrancaid
- Created: 2021-05-29T17:38:25.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-06-03T09:49:31.000Z (over 4 years ago)
- Last Synced: 2025-01-16T17:59:39.176Z (12 months ago)
- Topics: api, docker, docker-compose, gin-gonic, go, go-api, golang, gorm, makefile
- Language: Go
- Homepage:
- Size: 41 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Go Api
My first API developed in Go, built with Gin and Gorm.
## Requirements
- Go 1.16
- Docker & Docker Compose
## Setup
Run below code to setup go-api with docker:
```zsh
docker-compose --build up
# or
make run_docker
```
If you want use go-api without docker:
```zsh
make run_postgres # you need a postgres database
make run
```
## API Requests
[](https://insomnia.rest/run/?label=Go%20API&uri=https%3A%2F%2Fgithub.com%2Flucasfrancaid%2Fgo-api%2Fblob%2Fmain%2Fdocs%2Finsomnia.json)
### Authors
[POST] Create Author --> http://localhost:8080/v1/authors
[GET] Get All Authors --> http://localhost:8080/v1/authors
[GET] Get Author --> http://localhost:8080/v1/authors/1
[GET] Get Author Books --> http://localhost:8080/v1/authors/1/books
[PUT] Update Author --> http://localhost:8080/v1/books/1
[DELETE] Delete Authors --> http://localhost:8080/v1/authors/1
```json
// [post, put] request schema
{
"name": "Robert C. Martin (Uncle Bob)",
"site": "https://github.com/unclebob"
}
```
### Books
[POST] Create Book --> http://localhost:8080/v1/books
[GET] Get All Books --> http://localhost:8080/v1/books
[GET] Get Book --> http://localhost:8080/v1/books/1
[PUT] Update Book --> http://localhost:8080/v1/books/1
[DELETE] Delete Books --> http://localhost:8080/v1/books/1
```json
// [post, put] request schema
{
"title": "Clean Coder",
"author_id": 1,
"price": 19.89,
"published": "2018-11-22T15:04:00Z"
}
```