Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jennwah/go-webhttp-backend
A web-http-go-api-service template
https://github.com/jennwah/go-webhttp-backend
docker-compose elk gin go mysql redis
Last synced: 24 days ago
JSON representation
A web-http-go-api-service template
- Host: GitHub
- URL: https://github.com/jennwah/go-webhttp-backend
- Owner: jennwah
- License: apache-2.0
- Created: 2023-04-30T01:08:05.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-05-07T03:45:40.000Z (over 1 year ago)
- Last Synced: 2024-11-19T17:03:03.823Z (about 1 month ago)
- Topics: docker-compose, elk, gin, go, mysql, redis
- Language: Go
- Homepage:
- Size: 232 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go template for web http API service
- [Gin framework](https://github.com/gin-gonic/gin)
- Clean Architecture
- MySQL Database integration
- Redis Cache integration
- Docker compose development
- minikube local development for kubernetes
- ELK integration for application's logs## To bootstrap service with docker compose
1. install go dependencies `go get ./...`
2. run `make run-app` to bootstrap app with docker compose
3. `make migrations.up` for database migrations
4. try CURL
```bash
curl --location --request POST 'http://localhost:8080/api/v1/task' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "new task"
}'
```
5. try CURL
```
curl --location --request GET 'http://localhost:8080/api/v1/task/1' \
--header 'Content-Type: application/json' \
```
6. Check application's logs at http://localhost:5601/app/logs/stream with Kibana UI
7. If you're interested in caching strategy used in this app, (read aside strategy), see on `Get task by ID usecase` on its implementation`docker exec -it {redis-container-id} redis-cli`
`HGET key fields..`
## To bootstrap service with minikube
1. `brew install minikube`
2. `minikube start`
3. `kubectl apply -f {all files in ./kubernetes dir}`
4. `kubectl logs -l app=backend/mysql/redis` to debug. `kubectl get pods`, `kubectl describe pods {pod_name}`, `kubectl get deployments`
5. `minikube service backend -url` to get backend server URL.## Reference Gin's [Quick Start Guide] (https://github.com/gin-gonic/gin/blob/master/docs/doc.md)
- for web development stuff such as middlewares, custom validators, handling errors, routes, request binding and etc