https://github.com/maciekmm/hackathon-hackyeah-foodaway-backend
HackYeah! Entry - Food sharing application
https://github.com/maciekmm/hackathon-hackyeah-foodaway-backend
hackathon
Last synced: 23 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 (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-29T09:44:18.000Z (about 8 years ago)
- Last Synced: 2025-10-06T13:07:53.339Z (about 1 month ago)
- Topics: hackathon
- Language: Go
- Homepage: https://foodaway.kochanow.ski/
- Size: 517 KB
- Stars: 0
- Watchers: 1
- 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@example.com",
"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@example.com",
"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"
}
```