A REST API examples for simple todo application with Go
It is a just simple tutorial or example for making simple REST API with Go using Gin Web Framework and mongo-driver (An ORM of the mongo for Go)
# Download this project
git clone https://github.com/Andreis3/recipes-api.git
go mod downloadmake reload-server # run reload server
make compose-up # up mongo, redis, prometheus and grafana
make compose-down # down mongo, redis, prometheus and grafana
make compose-build # build mongo, redis, prometheus and grafana
make swagger-up # up swagger- https://goswagger.io/install.html
- swagger version
GET: Get all recipesPOST: Create a new recipe
PUT: Update a recipeDELETE: Delete a recipeGET: Get a recipe
GET: Get all recipes by tags
POST: User signed in
POST: User signed out
- http_requests_total
- http_request_duration_seconds
- http_status_codes_total
# Prometheus
- configure prometheus data source http://localhost:9090
Tutorial dashboard
create app.env
PORT=8080
MONGO_URI=mongodb://root:root@localhost:27017/test?authSource=admin
MONGO_DB=demo
COLLECTION_RECIPES=recipes
COLLECTION_USERS=users
REDIS_URI=localhost:6379
REDIS_PASSWORD=
REDIS_DB=0
X_API_KEY=1234560abcdetghig