|
1 | | -# chi-go-template |
2 | | -📝 [WIP] Chi backend template for Create Go App CLI. |
| 1 | +# go-chi backend template for [Create Go App CLI](https://github.com/create-go-app/cli) |
| 2 | + |
| 3 | +<img src="https://img.shields.io/badge/Go-1.17+-00ADD8?style=for-the-badge&logo=go" alt="go version" /> |
| 4 | + <a href="https://goreportcard.com/report/github.com/create-go-app/fiber-go-template" target="_blank"><img src="https://img.shields.io/badge/Go_report-A+-success?style=for-the-badge&logo=none" alt="go report" /></a> |
| 5 | + <img src="https://img.shields.io/badge/license-Apache_2.0-red?style=for-the-badge&logo=none" alt="license" /> |
| 6 | + |
| 7 | +[chi](https://go-chi.io/#/) iis a lightweight, idiomatic and composable router for building Go HTTP services. |
| 8 | + |
| 9 | +## ⚡️ Quick start |
| 10 | + |
| 11 | +1. Create a new project with Fiber: |
| 12 | + |
| 13 | +```bash |
| 14 | +cgapp create |
| 15 | + |
| 16 | +# Choose a backend framework: |
| 17 | +# net/http |
| 18 | +# fiber |
| 19 | +# > go-chi |
| 20 | +``` |
| 21 | + |
| 22 | +2. Rename `.env.example` to `.env` and fill it with your environment values. |
| 23 | +3. Install [Docker](https://www.docker.com/get-started) and the following useful Go tools to your system: |
| 24 | + |
| 25 | +- [golang-migrate/migrate](https://github.com/golang-migrate/migrate#cli-usage) for apply migrations |
| 26 | +- [github.com/securego/gosec](https://github.com/securego/gosec) for checking Go security issues |
| 27 | +- [github.com/go-critic/go-critic](https://github.com/go-critic/go-critic) for checking Go the best practice issues |
| 28 | +- [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) for checking Go linter issues |
| 29 | + |
| 30 | +4. Run project by this command: |
| 31 | + |
| 32 | +```bash |
| 33 | +make docker.run |
| 34 | +``` |
| 35 | + |
| 36 | +## 📦 Used packages |
| 37 | + |
| 38 | +| Name | Version | Type | |
| 39 | +|-----------------------------------------------------------------------| -------- | ---------- | |
| 40 | +| [go-chi/chi](https://github.com/go-chi/chi) | `v5.0.7` | core | |
| 41 | +| [joho/godotenv](https://github.com/joho/godotenv) | `v1.4.0` | config | |
| 42 | + |
| 43 | +## ⚙️ Configuration |
| 44 | + |
| 45 | +```ini |
| 46 | +# .env |
| 47 | + |
| 48 | +# Stage status to start server: |
| 49 | +# - "dev", for start server without graceful shutdown |
| 50 | +# - "prod", for start server with graceful shutdown |
| 51 | +STAGE_STATUS="dev" |
| 52 | + |
| 53 | +# Server settings: |
| 54 | +SERVER_HOST="0.0.0.0" |
| 55 | +SERVER_PORT=5000 |
| 56 | +SERVER_READ_TIMEOUT=5 |
| 57 | +SERVER_WRITE_TIMEOUT=10 |
| 58 | +SERVER_IDLE_TIMEOUT=120 |
| 59 | +``` |
| 60 | + |
| 61 | +## ⚠️ License |
| 62 | + |
| 63 | +Apache 2.0 © [Vic Shóstak](https://shostak.dev/) & [True web artisans](https://1wa.co/). |
0 commit comments