This is the server side of a movie app. The app provides users with access to information about different movies, directors, and genres. Users are able to sign up and login, update their personal information, and create a list of their favorite movies. The REST API and database are built using Node.js, Express, and MongoDB. The business logic is modeled with Mongoose. The endpoints of the API can be accessed with HTTP methods (POST, GET, PUT, and DELETE) to Create, Read, Update, and Delete (CRUD) data from the database.
- Node.js
- Express
- MongoDB
- bcryptjs
- body-parser
- CORS
- Express
- express validator
- JsonWebToken
- Morgan
- MongoDB
- Mongoose
- Passport
Endpoint: /movies
HTTP method: GET
Request body data format: none
Response body data format: JSON object holding data about all movies
Endpoint: /movies/[movie ID]
HTTP method: GET
Request body data format: none
Response body data format: JSON object holding data about a movie containing description, genre, director, image URL
Format:
{
Title: String, (required)
Description: String, (required)
Genre: {
Name: String,
Description: String
},
Director: {
Name: String,
Bio: String,
Birth: Date, ("YYYY-MM-DD")
Death: Date ("YYYY-MM-DD")
},
ImagePath: String,
Featured: Boolean
}
Endpoint: /genres/[genre name]
HTTP method: GET
Request body data format: none
Response body data format: JSON object holding data about a genre
Format:
{
Name: String,
Description: String
}
Endpoint: /directors/[name]
HTTP method: GET
Request body data format: none
Response body data format: JSON object holding data about a director including bio, birth year, death year
Format:
{
Name: String,
Bio: String,
Birth: Date, ("YYYY-MM-DD")
Death: Date ("YYYY-MM-DD")
}
Endpoint: /users
HTTP method: POST
Request body data format: JSON object holding data about the new user including username and mail
Format:
{
Username: String, (required)
Password: String, (required)
Email: String, (required)
Birthday: Date, ("YYYY-MM-DD")
FavoriteMovies: Array
}
Response body data format: JSON object holding data about the new user including ID, username and mail
Format:
{
ObjectId: String,
Username: String,
Password: String,
Email: String,
Birthday: Date, ("YYYY-MM-DD")
FavoriteMovies: Array
}
Endpoint: /users/[username]
HTTP method: GET
Request body data format: none
Response body data format: JSON object holding the data about the user
Format:
{
ObjectId: String,
Username: String,
Password: String,
Email: String,
Birthday: Date, ("YYYY-MM-DD")
FavoriteMovies: Array
}
Endpoint: /users/[username]
HTTP method: PUT
Request body data format: JSON object with the new user infos
Format:
{
Username: String, (required)
Password: String, (required)
Email: String, (required)
Birthday: Date ("YYYY-MM-DD")
}
Response body data format: JSON object holding the data about the new user
Format:
{
ObjectId: String,
Username: String,
Password: String,
Email: String,
Birthday: Date, ("YYYY-MM-DD")
FavoriteMovies: Array
}
Endpoint: /users/[username]/movies/[movie ID]
HTTP method: PUT
Request body data format: none
Response body data format: JSON object holding the new data about the user
Format:
{
ObjectId: String,
Username: String,
Password: String,
Email: String,
Birthday: Date, ("YYYY-MM-DD")
FavoriteMovies: Array
}
Endpoint: /users/[username]/movies/[movie ID]
HTTP method: DELETE
Request body data format: none
Response body data format: JSON object holding the data about the user without the deleted movie
Format:
{
ObjectId: String,
Username: String,
Password: String,
Email: String,
Birthday: Date, ("YYYY-MM-DD")
FavoriteMovies: Array
}
Endpoint: /users/[username]
HTTP method: DELETE
Request body data format: none
Response body data format: Text message indicating that the user email was removed