Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lbrulet/apinit-go
[apiREST] Setup | Golang - mysql - Mail sender - AUTH0 - JWT with Docker and Nginx
https://github.com/lbrulet/apinit-go
api authentification docker docker-compose go golang jwt mail-sender mysql nginx restful-api smtp
Last synced: about 1 month ago
JSON representation
[apiREST] Setup | Golang - mysql - Mail sender - AUTH0 - JWT with Docker and Nginx
- Host: GitHub
- URL: https://github.com/lbrulet/apinit-go
- Owner: lbrulet
- License: mit
- Created: 2019-07-15T10:15:34.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-09T02:43:20.000Z (about 5 years ago)
- Last Synced: 2024-06-19T05:28:07.737Z (6 months ago)
- Topics: api, authentification, docker, docker-compose, go, golang, jwt, mail-sender, mysql, nginx, restful-api, smtp
- Language: Go
- Homepage:
- Size: 1.74 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Go Report Card](https://goreportcard.com/badge/github.com/lbrulet/APINIT-GO)](https://goreportcard.com/report/github.com/lbrulet/APINIT-GO)
# APINIT-GOAPINIT-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](https://curl.haxx.se/) to install [Docker Compose](https://docs.docker.com/compose/install/#install-compose).
```bash
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:```bash
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
```bash
cd docker && ./build && ./start
```To stop the app
```bash
cd docker && ./stop
```## CHOOSE YOUR ENVIRONNMENT !
Use this export to connect the api to your local mongo.
```bash
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 :```bash
export [email protected]
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](https://github.com/lbrulet/APINIT-GO/blob/master/docs/APINIT-GO.postman_collection.json)
[Postman environment](https://github.com/lbrulet/APINIT-GO/blob/master/docs/APINIT-GO.postman_environment.json)
## AUTHENTIFICATION
* __POST__: 127.0.0.1:8080/api/auth/login
```json
{
"username": "sankamille",
"password": "password123"
}
```* __POST__: 127.0.0.1:8080/api/auth/register
```json
{
"username": "sankamille",
"email": "[email protected]",
"password": "password123"
}
```