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.
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
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
Use this export to connect the api to your local mongo.
export ENVIRONMENT=LOCAL
Otherwise you can just used the docker compose.
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
Download those two files and import them into your postman.
- 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"
}