Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions Semana13/Projeto/Labefood
Submodule Labefood added at b8b2f6
1 change: 1 addition & 0 deletions Semana16/Projeto/epps-labenu-system13
Submodule epps-labenu-system13 added at 150f9c
18 changes: 18 additions & 0 deletions Semana18/Projeto/Warmup.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
1)

const fatorial = (entrada) => {
let saida=1

if(entrada.length === 0){
return 1;
}

for(let i=0; i<entrada.length; i++){


saida=saida*(i+1)

}

return saida
}
8 changes: 8 additions & 0 deletions Semana18/Projeto/template-labook/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DB_HOST = 35.226.146.116
DB_USER =
DB_PASSWORD =
DB_SCHEMA =

JWT_KEY =

BCRYPT_COST =
93 changes: 93 additions & 0 deletions Semana18/Projeto/template-labook/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# LABOOK

## Primeiros Passos

* Clonar este repositório
* Executar `npm install` para adicionar as dependências
* Criar um arquivo .env na raiz do projeto e preencher as chaves a seguir com os valores apropriados:
```
DB_HOST =
DB_USER =
DB_PASSWORD =
DB_SCHEMA =

JWT_KEY =

BCRYPT_COST =
```
* Executar `npm run migrations` para adicionar as tabelas ao banco de dados (em caso de sucesso, o servidor já estará pronto para receber requisições )

## Endpoints

1. Cadastro
* Exemplo de requisição:
```bash
curl -i -X POST http://localhost:3003/users/signup -H "Content-Type: application/json" -d '{"name":"Alice","email":"alice@gmail.com","password":"pass123"}'
```
* Exemplo de resposta (sucesso):
```bash
HTTP/1.1 201 Created
X-Powered-By: Express
Access-Control-Allow-Origin: *
Content-Type: application/json; charset=utf-8
Content-Length: 220
ETag: W/"dc-ec7r4rkKsMBe/V0SGyUkO6Vyto0"
Date: Tue, 17 Nov 2020 14:33:15 GMT
Connection: keep-alive

{"message":"Success!", "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Ijg5OGJjNDVlLTExZjEtNGEyMy04OTZhLTdmMmUyOWNmZTAxMiIsImlhdCI6MTYwNTYyMzU5NSwiZXhwIjoxNjA1NzA5OTk1fQ.pWxV2vtLnp0hKm0CXXnLpnDu6PEPkZM27A71oTTCYfE"}%
```
1. Login
* Exemplo de requisição:
```bash
curl -i -X POST http://localhost:3003/users/login -H "Content-Type: application/json" -d '{"email":"alice@gmail.com","password":"pass123"}'
```
* Exemplo de resposta (sucesso):
```bash
HTTP/1.1 200 OK
X-Powered-By: Express
Access-Control-Allow-Origin: *
Content-Type: application/json; charset=utf-8
Content-Length: 220
ETag: W/"dc-IBDYVXSmDzdFsqHXhPCAutzNwn8"
Date: Tue, 17 Nov 2020 14:39:23 GMT
Connection: keep-alive

{"message":"Success!","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Ijg5OGJjNDVlLTExZjEtNGEyMy04OTZhLTdmMmUyOWNmZTAxMiIsImlhdCI6MTYwNTYyMzk2MywiZXhwIjoxNjA1NzEwMzYzfQ.9JvXRQpazI5k6GAnc1lFcVcTbZ_ElASnwyybU_tRU48"}%
```
1. Criar Post
* Exemplo de requisição:
```bash
curl -i -X POST http://localhost:3003/posts/create -H "Content-Type: application/json" -H "authorization:$token" -d '{"photo":"https://i.picsum.photos/id/238/200/200.jpg?hmac=O4Jc6lqHVfaKVzLf8bWssNTbWzQoaRUC0TDXod9xDdM","description":"My city is beautiful =D","type":"normal"}'
```
* Exemplo de resposta (sucesso):
```bash
HTTP/1.1 201 Created
X-Powered-By: Express
Access-Control-Allow-Origin: *
Content-Type: application/json; charset=utf-8
Content-Length: 22
ETag: W/"16-ChcZhlw1slqtGuDwxLsUclql5gE"
Date: Tue, 17 Nov 2020 14:47:15 GMT
Connection: keep-alive

{"message":"Success!"}%
```
1. Buscar Post por id
* Exemplo de requisição:
```bash
curl -i http://localhost:3003/posts/$id -H "Content-Type: application/json" -H "authorization:$token"
```
* Exemplo de resposta (sucesso):
```bash
HTTP/1.1 200 OK
X-Powered-By: Express
Access-Control-Allow-Origin: *
Content-Type: application/json; charset=utf-8
Content-Length: 322
ETag: W/"142-IYRwCODXZBltXE3MydHuIDB8M3w"
Date: Tue, 17 Nov 2020 14:52:19 GMT
Connection: keep-alive

{"message":"Success!","post":{"id":"e4eb1531-d814-4742-b614-be2a36602548","photo":"https://i.picsum.photos/id/238/200/200.jpg?hmac=O4Jc6lqHVfaKVzLf8bWssNTbWzQoaRUC0TDXod9xDdM","description":"My city is beautiful =D","type":"normal","createdAt":"2020-11-17T17:47:15.000Z","authorId":"898bc45e-11f1-4a23-896a-7f2e29cfe012"}}%
```
201 changes: 201 additions & 0 deletions Semana18/Projeto/template-labook/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Semana18/Projeto/template-labook/build/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions Semana18/Projeto/template-labook/build/migrations.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Semana18/Projeto/template-labook/build/migrations.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Semana18/Projeto/template-labook/node_modules/.bin/atob

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Semana18/Projeto/template-labook/node_modules/.bin/atob.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading