chore: add documentation
This commit is contained in:
104
README.md
104
README.md
@@ -1,2 +1,104 @@
|
||||
# boussole-pluss
|
||||
# Bousolle PLUSS
|
||||
|
||||
Le projet backend contient la partie backend de la Bousolle PLUSS. Le projet frontend, le fontend communiquant avec le backend.
|
||||
|
||||
## Installation
|
||||
|
||||
En utilisant docker-compose:
|
||||
`docker-compose build` en modifiant au préalable l'argument BACKEND_BASE_URL du fichier
|
||||
docker-compose.yml pour spécifier l'URL sur laquelle pointera le backend.
|
||||
`docker-compose up` pour lancer le frontend et backend.
|
||||
|
||||
Exemple de configuration Nginx compatible avec le docker-compose de ce projet (URL_EXTERNE est à remplacer
|
||||
par l'URL publique) :
|
||||
|
||||
```
|
||||
upstream springboot {
|
||||
server 127.0.0.1:8191;
|
||||
}
|
||||
|
||||
server {
|
||||
server_name URL_EXTERNE;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8190;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Server $host;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-NginX-Proxy true;
|
||||
|
||||
rewrite ^/api/(.*)$ /$1 break;
|
||||
proxy_pass http://springboot;
|
||||
}
|
||||
|
||||
error_log /var/log/nginx/pluss_error.log;
|
||||
|
||||
listen [::]:80;
|
||||
listen 80;
|
||||
}
|
||||
```
|
||||
|
||||
Ceci est un exemple à ne pas utiliser sur un environnement de production.
|
||||
|
||||
## Administration
|
||||
|
||||
Par la suite, `__URL__` est l'URL du backend, `__USER__` et `__PASSWORD__` le nom de compte et mot de passe à créer / utiliser.
|
||||
### Créer un nouveau compte
|
||||
```bash
|
||||
curl --location --request POST '__URL__/api/auth/signup' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"username": "__USER__",
|
||||
"password": "__PASSWORD__"
|
||||
}'
|
||||
```
|
||||
|
||||
### Se connecter
|
||||
```bash
|
||||
curl --location --request POST '__URL__/api/auth/signin' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"username": "__USER__",
|
||||
"password": "__PASSWORD__"
|
||||
}'
|
||||
```
|
||||
Cet appel renverra un token à réutiliser pour l'ensemble des requêtes. Par exemple :
|
||||
|
||||
```json
|
||||
{
|
||||
"token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkZW1vIiwiaWF0IjoxNjY1NjY5NjUyLCJleHAiOjE2NjU2NzMyNTJ9.i426thZKL4-JvOt9ZeG2D1O6O-xlSiPoCMiKysHYzCkHVNrnxKetq8xKRNCTnbpLV-wagpOw2g-om34k2jtHIw",
|
||||
"refreshToken": "de73adcb-a5a8-4675-8bb3-5536651be0f9",
|
||||
"id": 11,
|
||||
"username": "demo"
|
||||
}
|
||||
```
|
||||
|
||||
### Afficher les balises (axe)
|
||||
```bash
|
||||
curl --location --request GET '__URL__/api/axes' \
|
||||
--header 'Authorization: Bearer TOKEN'
|
||||
```
|
||||
Le TOKEN est à remplacer par celui reçu.
|
||||
|
||||
### Ajouter une question à un axe
|
||||
```bash
|
||||
curl --location --request POST '__URL__/api/questions' \
|
||||
--header 'Authorization: Bearer TOKEN' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '
|
||||
{
|
||||
"axe": "URL_BALISE_1",
|
||||
"label": "Question 1",
|
||||
"description": "Description .."
|
||||
}
|
||||
'
|
||||
```
|
||||
Il faut spécifier URL_BALISE_1 comme étant l'URL de la balise 1 récupérer dans la requête précédente.
|
||||
Par exemple : `__URL__/axes/1`
|
Reference in New Issue
Block a user