Foodsharing idea implementation.
In order to start the backend you need to have a docker-compose and run the following commands:
cp ./credentials.env.sample ./credentials.env
vi ./credentials.env #change values in credentials.env to yours
docker-compose up --build
docker exec hackyeah_api_1 go run cmd/mock/main.go N
where N is a number of records to be generated
Sample request:
{
"name": "Your Name",
"email": "[email protected]",
"password": "your-password"
}
Sample response:
{
"token": "JWT-token"
}
All future requests have to contain Authorization: Bearer YOUR-JWT-TOKEN
header. Token is valid for 24h
{
"email": "[email protected]",
"password": "your-password"
}
Sample response:
{
"token": "JWT-token"
}
Used to refresh expired token. Pass old token in Authorization
header and a new one will be returned.
Sample response:
{
"token": "new-jwt-token"
}