A simple monolithic app serving RESTful APIs. This repo contains some best practices that could be referred in production and learning purpose. And all the codes are original written by Yuxin Zhang ([email protected])
- Gin Web Framework
- Air - Live reload for Go apps
- MySql
- GORM - The fantastic ORM library for Golang
- redis
A lot of components are used to make this server more complete and fancy. So be sure to install them as you needed.
The following components are required for you to run this app in your local environment:
Please refer to this address to install MySql on your local machine: https://dev.mysql.com/downloads/mysql/
Your server should be ready in the following configurations or change the Makefile
to meet your settings:
ip: localhost(127.0.0.1)
port: 3306
password: 1qaz!QAZ
DB schema: taylorzh
The following components are used to either improve your dev experience or to enhance the server.
It's a good idea to do TDD or to verify your code in real-time. This tool offers the ability to auto rebuild and reload your app every time the file is changed. Be sure to use it to shorten the feedback loop of the dev cycle.
go install github.com/cosmtrek/air@latest
https://redis.io/docs/getting-started/
Run the following command to run this app on your local machine:
make dev # if you installed air
make run # if you don't have air
check the server is running
curl localhost:8080/healthcheck
# OK 2022-08-20T17:02:23+08:00
curl localhost:8080/hello
# {"count":1,"message":"hello world"}
- load counter
- async task runner
- logger
Sometimes we want to load test the performance of our backend service and to collect the request metrics of the service. These apis give you the metrics of the request in various dimensions.
TODO
TODO