https://github.com/douglaszuqueto/go-api-boilerplate
Exemplo de API utilizando a linguagem Go e a biblioteca Gorilla Mux
https://github.com/douglaszuqueto/go-api-boilerplate
api boilerplate go gorilla-mux
Last synced: 7 months ago
JSON representation
Exemplo de API utilizando a linguagem Go e a biblioteca Gorilla Mux
- Host: GitHub
- URL: https://github.com/douglaszuqueto/go-api-boilerplate
- Owner: douglaszuqueto
- License: mit
- Created: 2020-06-11T17:35:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-24T16:42:07.000Z (about 5 years ago)
- Last Synced: 2025-03-25T19:21:19.808Z (8 months ago)
- Topics: api, boilerplate, go, gorilla-mux
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 24
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-golang-repositories - go-api-boilerplate
README
# GO API boilerplate
Exemplo de arquitetura de API utilizando a linguagem Go
## Arquitetura
* 3 áreas
* admin
* client
* auth
* Storage
* Memory
```bash
http
├── api
│ ├── admin
│ │ ├── api.go
│ │ └── user.go
│ ├── auth
│ │ ├── api.go
│ │ └── login.go
│ └── client
│ ├── api.go
│ └── user.go
├── main.go
├── middleware
│ ├── cors.go
│ ├── logger.go
│ ├── max_client.go
└── utils
└── handler.go
```
## Endpoints
### Admin
| Description | http | path |
|:--:|:--:|:--|
| list | GET | /api/admin/user |
| get | GET | /api/admin/user/:id |
| store | POST | /api/admin/user |
| update | PUT | /api/admin/user/:id |
| delete | DELETE | /api/admin/user/:id |
### Public
| Description | http | path |
|:--:|:--:|:--|
| list | GET | /api/user |
| get | GET | /api/user/:id |
### Auth
| Description | http | path |
|:--:|:--:|:--|
| admin | POST | /api/auth/admin/signin |
| public | POST | /api/auth/client/signin |
## Insomnia
Lista de todas requisições para usar com Insomnia, basta importar :) => [link](./.github/Go-API-boilerplate_2020-06-26.json)
## Dependências
* [Gorilla Mux](github.com/gorilla/mux)
* [Gorilla Handlers](github.com/gorilla/handlers)
## Build & Deploy
### Standalone
* Build
```bash
make prod
```
* Deploy
```bash
./bin/go-api-boilerplate
```
### Docker
* Build
```bash
make docker
```
* Push
```bash
make docker-push
```
* Deploy
```bash
docker run -it --name go-api-boilerplate \
-p 3000:3000 \
douglaszuqueto/go-api-boilerplate:latest
```
## Referências