Skip to content

Andreis3/recipes-api

Repository files navigation

Recipes API simple REST API example

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)

Installation & Run

# Download this project
git clone https://github.com/Andreis3/recipes-api.git
go mod download

Frameworks

Make command

make 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

Install swagger

API

/recipes

  • GET : Get all recipes
  • POST : Create a new recipe

/recipes/:id

  • PUT : Update a recipe
  • DELETE : Delete a recipe
  • GET : Get a recipe

/recipes/search?tag=:tags

  • GET : Get all recipes by tags

/signin

  • POST : User signed in

/signout

  • POST : User signed out

Prometheus & Grafana

  • 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors