https://github.com/joaovicdsantos/whosbest
Create polls and let people decide who is best.
https://github.com/joaovicdsantos/whosbest
api golang gorilla-websocket graphql http jwt websocket
Last synced: about 1 month ago
JSON representation
Create polls and let people decide who is best.
- Host: GitHub
- URL: https://github.com/joaovicdsantos/whosbest
- Owner: joaovicdsantos
- Created: 2021-12-12T04:09:56.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-01-27T23:10:19.000Z (over 2 years ago)
- Last Synced: 2025-02-23T10:17:40.785Z (over 1 year ago)
- Topics: api, golang, gorilla-websocket, graphql, http, jwt, websocket
- Language: Go
- Homepage:
- Size: 87.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

Whosbest API é um backend para a plataforma de competições e enquetes, Whosbest.
Trata-se de uma Web API construída em [Go](https://go.dev/) com [GraphQL](https://graphql.org/)
para as requisições e [WebSocket](https://developer.mozilla.org/pt-BR/docs/Web/API/WebSockets_API)
para uma análise em tempo real dos resultados. Além disso a persistência dos dados é feita em um
banco [PostgreSQL](https://www.postgresql.org/).
## Referências
- [go-graphql](https://github.com/graphql-go/graphql)
- [golang-jwt](https://github.com/golang-jwt/jwt)
- [golang-migrate](https://github.com/golang-migrate/migrate)
- [websocket](https://github.com/gorilla/websocket)
## Variáveis de Ambiente
Para rodar esse projeto, você vai precisar adicionar algumas variáveis de ambiente no seu `.env`. De forma geral,
recomendamos que o arquivo `.env.example` seja copiado, ele já fornece o mínimo necessário para iniciar o projeto,
não sendo necessário configurações adicionais.
## Rodando localmente
Clone o projeto
```bash
git clone git@github.com:joaovicdsantos/whosbest-api.git
```
Entre no diretório do projeto
```bash
cd whosbest-api
```
Execute as migrações
```bash
docker compose --profile tools run migrate
```
Rode com docker compose
```bash
docker compose up -d
```
## Documentação da API
#### Cadastrar
```http
POST /register
```
| Body | Tipo | Descrição |
| :---------- | :--------- | :---------------------------------- |
| `username` | `string` | Nickname de usuário |
| `password` | `string` | Senha do usuário |
#### Logar
```http
POST /login
```
| Body | Tipo | Descrição |
| :---------- | :--------- | :---------------------------------- |
| `username` | `string` | Nickname de usuário |
| `password` | `string` | Senha do usuário |
```http
GET /graphql
```
| Body | Tipo | Descrição |
| :---------- | :--------- | :---------------------------------- |
| `query` | `string` | GraphQL query |
Além destes, há o endpoint relacioando ao WebSocket.
```http
WEBSOCKET /ws
```
## Licença
[MIT](https://choosealicense.com/licenses/mit/)
## Autores
- [@joaovicdsantos](https://www.github.com/joaovicdsantos)