- Verifique se as portas
3000
e8080
estão disponíveis
- Clonar este repositório
git clone https://github.com/Wilhelm-Zimmermann/GiovanellaFlix.git
- No My Sql é necessário criar um usuário chamado
giovanella
com a senha123456789
e a base de dados deve ter o nome degiovanella_schema
- Passo a passo para criar um usuário no MySql
- Criar um arquivo .env e declarar esta variável
DATABASE_URL="mysql://giovanella:123456789@localhost:3306/giovanella_schema"
- Abrir um terminal na pasta server e executar o comando
npm install
ouyarn
, e esperar instalar todas as dependências - Executar o comando
yarn prisma migrate dev
ounpx prisma migrate dev
- Rodar a aplicação
yarn dev
ounpm run dev
- Também é possível rodar a build
npm run build
ouyarn build
e depoisnode ./dist/server.js
- Para executar os testes automatizados digite o comando
yarn test
ounpm run test
...
- Abrir um terminal na pasta web e executar o comand
yarn
ounpm install
- Depois
yarn start
ounpm start
para rodar o frontend...
- Typescript
- Express
- Multer
- Babel
- Typescript
- Prisma
- Typescript
- Jest
- Eslint
- Bcrypt
- Cors
- Json Web Token
- Express Async Errors
- Tsyringe
- Reflect Metadata
- https://www.tvmaze.com/api: api onde estão registrados os filmes)
Retorna um array de filmes:
[
{
"id": 2,
"name": "Person of Interest",
"summary": "<p>You are being watched. The government has a secret system, a machine that spies on you every hour of every day. I know because I built it. I design...",
"averageRate": 0,
"image": {
"medium": "https://static.tvmaze.com/uploads/images/medium_portrait/163/407679.jpg"
}
}
]
Retorna um array de filmes já avaliados:
[
{
"id": 2,
"name": "Person of Interest",
"summary": "<p>You are being watched. The government has a secret system, a machine that spies on you every hour of every day. I know because I built it. I design...",
"averageRate": 10,
"image": {
"medium": "https://static.tvmaze.com/uploads/images/medium_portrait/163/407679.jpg"
}
}
]
Retorna um filme com base no id:
{
"id": 2,
"name": "Person of Interest",
"summary": "<p>You are being watched. The government has a secret system, a machine that spies on you every hour of every day. I know because I built it. I design...",
"averageRate": 10,
"image": {
"medium": "https://static.tvmaze.com/uploads/images/medium_portrait/163/407679.jpg"
}
}
Retorna um array de filmes baseado na query que é passada
[
{
"id": 2,
"name": "Person of Interest",
"summary": "<p>You are being watched. The government has a secret system, a machine that spies on you every hour of every day. I know because I built it. I design...",
"averageRate": 10,
"image": {
"medium": "https://static.tvmaze.com/uploads/images/medium_portrait/163/407679.jpg"
}
}
]
Rota para criar o filme: O body deve conter
{
"id": 2,
"name": "Person of Interest",
"summary": "<p>You are being watched. The government has a secret system, a machine that spies on you every hour of every day. I know because I built it. I design...",
"imageURL": "https://static.tvmaze.com/uploads/images/medium_portrait/163/407679.jpg"
}
Rota para criar um usuário: O body deve conter.
{
"email":"usuario@outlook.com",
"name":"user",
"password":"123455"
}
Rota para logar um usuário: O body deve conter.
{
"email":"usuario@outlook.com",
"password":"123455"
}
Retorna:
{
"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI3N2Q3YjY2MC02YTkxLTQ0YTUtYWQyYy1hZGE3ODQzZmY3ZTMiLCJpYXQiOjE2ODUzNjkzMzQsImV4cCI6MTY4NTQ1NTczNH0.EYRPwUNho8AeS1UdW6PBkK9ED8ua9LP6KCxXsjDT_JI"
}
Rota para fazer upload de uma foto de perfil: o body deve ser em form-data.
profilePhoto
arquivo.jpg|png
Rota para pegar o perfil do usuário:
Deve conter o Header
Authorization
passando o Bearer token
.
Retorna:
{
"id": "8dbb3ad7-c53a-4527-88ed-fface24a877c",
"name": "user",
"email": "user@outlook.com",
"password": "$2b$08$BR4yZsZufybxKrbM.oBebOHAbPxWKEa1V7P3A7Zbdj./WWGRtrJAy",
"profileImageUrl": "http://localhost:8080/users/upload/"
}
Deve conter o Header
Authorization
passando o Bearer token
.
Retorna:
{
"movieUrl": "http://localhost:8080/movies/details/1",
"movieAverageRate": 5
}
{
"error": "Nome do erro"
}