Go to file
Matthieu Lamalle ef96cadb2e update internal path 2020-07-16 14:04:51 +02:00
cmd/jwtserver update dependencies 2020-07-16 11:25:13 +02:00
internal/router update internal path 2020-07-16 14:04:51 +02:00
middleware refactor project structure 2020-07-16 13:56:57 +02:00
misc/containers/postgres first commit 2020-07-16 10:51:50 +02:00
.env.dist first commit 2020-07-16 10:51:50 +02:00
.gitignore first commit 2020-07-16 10:51:50 +02:00
Makefile first commit 2020-07-16 10:51:50 +02:00
README.md first commit 2020-07-16 10:51:50 +02:00
docker-compose.yml first commit 2020-07-16 10:51:50 +02:00
go.mod typo 2020-07-16 11:21:17 +02:00
go.sum update package 2020-07-16 11:34:56 +02:00
jwt.go update package 2020-07-16 11:34:56 +02:00
jwtserver update internal path 2020-07-16 14:04:51 +02:00

README.md

Go-JWTServer

Serveur de gestion d'utilisateur et fournissant un token jwt.

Dépendances: docker, docker-compose

Configuration

Editer le ficher .env

## Server
web_adress=":3001"

## Postgres
db_user="jwtserver"
db_pass="jwtserver"
db_name="jwtserver"
db_host="localhost"

## JWT
token_password="NotSoSecretJwtSecretPassword"

API

Enregistrer un utilisateur

POST {{host}}/api/user/new 
content-type: application/json

{
    "email": "test@test.com",
    "password": "test"
}

Authentifier un utilisateur

POST {{host}}/api/user/login 
content-type: application/json

{
    "email": "test@test.com",
    "password": "test"
}

Réponse

{
  "account": {
    "ID": 1,
    "CreatedAt": "2020-07-15T14:08:22.288502Z",
    "UpdatedAt": "2020-07-15T14:08:22.288502Z",
    "DeletedAt": null,
    "email": "test@test.com",
    "password": "",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjF9.-bV_jRNcykDMsI-vjxKbiNBsEwqSfDspEEjBTE2nds8"
  },
  "message": "Logged In",
  "status": true
}

Executer le serveur

Lancer le conteneur postgres make up

Dans une autre console, lancer le serveur jwt make run