{
username: {
type: String,
required: true,
unique: true
},
password: {
type: String,
required: true
},
email: {
type: String,
required: true,
unique: true,
validate: [validateEmail,'Validation of `{PATH}` failed with value `{VALUE}`']
},
genres: [
{
type: String
}
],
movies: [
Ref Movie
movieId
]
}
{ title: String, genre: String, poster: String }
/api
.
├── /auth
│ └── POST
│ ├── /login
│ └── /refresh
├── /users
│ └── GET
│ └── GET/:id
│ └── POST
│ └── /
├── /
// req.body
{
email: String,
password: String
}
// res.body
{
authToken: String
}
// req.header
Authorization: Bearer ${token}
// res.body
{
authToken: ${token}
}
// req.query
{
?
}
// res.body
[
{
username: String,
movies: [],
genres: String
}
]
// req.params
{
id: ID
}
// res.body
{
username: String,
movies: [],
genres: String
}
// req.body
{
email: String,
username: String,
password: String
}
// res.body
{
name: String,
username: String
}
// req.body
{
genres: [String]
}
// res.body
{
genres: [String],
movies: [ID]
}