Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maciekmm/hackathon-hackyeah-foodaway-backend
HackYeah! Entry - Food sharing application
https://github.com/maciekmm/hackathon-hackyeah-foodaway-backend
hackathon
Last synced: 3 days ago
JSON representation
HackYeah! Entry - Food sharing application
- Host: GitHub
- URL: https://github.com/maciekmm/hackathon-hackyeah-foodaway-backend
- Owner: maciekmm
- Created: 2017-10-28T11:06:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-29T09:44:18.000Z (over 7 years ago)
- Last Synced: 2025-01-28T01:11:42.571Z (6 days ago)
- Topics: hackathon
- Language: Go
- Homepage: https://foodaway.kochanow.ski/
- Size: 517 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HackYeah Entry
Foodsharing idea implementation.
## Running
In order to start the backend you need to have a docker-compose and run the following commands:
```bash
cp ./credentials.env.sample ./credentials.env
vi ./credentials.env #change values in credentials.env to yours
docker-compose up --build
```### Generating fake data
```bash
docker exec hackyeah_api_1 go run cmd/mock/main.go N
```where N is a number of records to be generated
## Endpoints
### POST /accounts/register/
Sample request:
```json
{
"name": "Your Name",
"email": "[email protected]",
"password": "your-password"
}
```Sample response:
```json
{
"token": "JWT-token"
}
```All future requests have to contain `Authorization: Bearer YOUR-JWT-TOKEN` header. Token is valid for 24h
### POST /accounts/login/
```json
{
"email": "[email protected]",
"password": "your-password"
}
```Sample response:
```json
{
"token": "JWT-token"
}
```### GET /accounts/token/
Used to refresh expired token. Pass old token in `Authorization` header and a new one will be returned.
Sample response:
```json
{
"token": "new-jwt-token"
}
```