Ce projet est un template d'API REST en Go.
- Clonez le dépôt :
git clone https://github.com/LordPax/golang-api-template.git
- Accédez au répertoire du projet :
cd golang-api-template
- Lancer les conteneur docker
docker-compose up
- Accédez au répertoire du projet :
cd back
- Créez un fichier
.env
à la racine du répertoireback
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=
- Intaller les dépendances :
go mod tidy
go mod vendor
swag init
- Build le projet :
go build
- Lancer les migrations et les fixtures:
./golang-api migrate
./golang-api fixtures
- Lancer le projet
./golang-api