Golang api template

Description

Ce projet est un template d'API REST en Go.

Technologies utilisées

Initialisation du projet

  1. Clonez le dépôt :
git clone https://github.com/LordPax/golang-api-template.git
  1. Accédez au répertoire du projet :
cd golang-api-template
  1. Lancer les conteneur docker
docker-compose up

Installation back

  1. Accédez au répertoire du projet :
cd back
  1. Créez un fichier .env à la racine du répertoire back et ajoutez les variables d'environnement suivantes :
GIN_MODE=debug
ALLOWED_ORIGINS='*'

DB_HOST=localhost
DB_USER=root
DB_PASSWORD=root
DB_NAME=golang-app
DB_PORT=5432

COOKIE_SECURE=false
JWT_SECRET_KEY=secret
BREVO_API_KEY=
BREVO_SENDER=noreply@uresport.fr

CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
  1. Intaller les dépendances :
go mod tidy
go mod vendor
swag init
  1. Build le projet :
go build
  1. Lancer les migrations et les fixtures:
./golang-api migrate
./golang-api fixtures
  1. Lancer le projet
./golang-api