Skip to content

Server-side for a movie app (MERN stack) that allows users to log in, update personal information, and access information about movies from a database.

Notifications You must be signed in to change notification settings

lkarow/movie_api

Repository files navigation

movie api

Project description

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.

Built With

  • Node.js
  • Express
  • MongoDB

Dependencies

Endpoints

Get data of all movies

Endpoint: /movies

HTTP method: GET

Request body data format: none

Response body data format: JSON object holding data about all movies

Get data of a single movie

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
}

Get data of a genre

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
}

Get data of a director

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")
}

Add new user

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
}

Get data of a single user

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
}

Update user data

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
}

Add movie to favorite list of user

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
}

Remove movie from favorite list of user

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
}

Delete user

Endpoint: /users/[username]

HTTP method: DELETE

Request body data format: none

Response body data format: Text message indicating that the user email was removed

About

Server-side for a movie app (MERN stack) that allows users to log in, update personal information, and access information about movies from a database.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published