Skip to content

[apiREST] Setup | Golang - mysql - Mail sender - AUTH0 - JWT with Docker and Nginx

License

Notifications You must be signed in to change notification settings

lbrulet/APINIT-GO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Report Card

APINIT-GO

APINIT-GO is a setup of an apiREST using Golang with a mysql database and Docker exposed with NGINX with an authentification service using JWT.

Installation

Use curl to install Docker Compose.

sudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Then apply executable permissions to the binary:

sudo chmod +x /usr/local/bin/docker-compose

Usage

The start and stop script will required your root password to shutdown your local mysql that use the port 3306.

To start the app

cd docker && ./build && ./start

To stop the app

cd docker && ./stop

CHOOSE YOUR ENVIRONNMENT !

Use this export to connect the api to your local mongo.

export ENVIRONMENT=LOCAL

Otherwise you can just used the docker compose.

MAIL SENDER

Don't forget to write your smtp detail into the /configs/local/config.json or /configs/dev/config.json And please export your mail account with password like below :

export MAIL_ADDRESS=luc.brulet@gmail.com
export MAIL_PASSWORD=azertyuiop

NOTE: The default config is the google's smtp address

DOCUMENTATIONS

Download those two files and import them into your postman.

Postman collection

Postman environment

AUTHENTIFICATION

  • POST: 127.0.0.1:8080/api/auth/login
{
    "username": "sankamille",
    "password": "password123"
}
  • POST: 127.0.0.1:8080/api/auth/register
{
    "username": "sankamille",
    "email": "luc.brulet@epitech.eu",
    "password": "password123"
}

Releases

No releases published

Packages

No packages published