To use this application locally, follow these steps inside your terminal:
- Clone this repository to your local machine:
git clone https://github.com/monicaalyssa/movie-api
- Navigate to the project directory:
cd movie-api
- Install dependencies:
npm install
- Start the development server:
npm start
- Open your browser and visit:
http://localhost:8082
Base URL
https://popcornpal-32d285ffbdf8.herokuapp.com/
GET
/movies
(gets a list of all movies)
None
HTTP Code Content-Type Response 200
application/json; charset=utf-8
JSON array of objects
GET
/movies/{uuid}
(gets data about a specific movie by id)
Name Data Type Description uuid
string The specific movie id
HTTP Code Content-Type Response 200
application/json; charset=utf-8
JSON object 500
text/html; charset=utf-8
"Error: " + message
https://popcornpal-32d285ffbdf8.herokuapp.com/movies/666f4ac82ea46717e439e608
{
"Genre": {
"Name": "Mystery",
"Description": "Mystery involves a mysterious death or a crime to be solved."
},
"Director": {
"Name": "Sam Esmail",
"Bio": "Sam Esmail is an American producer and writer, with 5 film award wins.",
"Birthdate": "1977-09-17T00:00:00.000Z"
},
"_id": "666f4ac82ea46717e439e608",
"Title": "Leave the World Behind",
"Description": "A family's getaway to a luxurious rental home takes an ominous turn when a cyberattack knocks out their devices, and two strangers appear at their door.",
"ImageURL": "https://m.media-amazon.com/images/M/MV5BMTUzM2I3NDEtMjNhYi00NTQ0LThmZDItZTMyMzM2MjJmZGRjXkEyXkFqcGdeQXVyMTU3NDU4MDg2._V1_.jpg",
"Featured": false,
"BannerURL": "https://stadt-bremerhaven.de/wp-content/uploads/2023/10/Leave-the-world-behind.jpg",
"Duration": "2h20m"
}
GET
/genre/{genrename}
(gets data about a specific genre by name)
Name Data Type Description genrename
string The name of the genre (case sensitive)
HTTP Code Content-Type Response 200
application/json; charset=utf-8
JSON object 404
text/html; charset=utf-8
genrename + "genre not found"
https://popcornpal-32d285ffbdf8.herokuapp.com/genre/Fantasy
{
"Name": "Fantasy",
"Description": "Fantasy stories are set in a faraway or fictional universe and are usually inspired by mythology and folklore."
}
GET
/directors/{directorname}
(gets data about a specific director by name)
Name Data Type Description directorname
string The name of the director (case sensitive)
HTTP Code Content-Type Response 200
application/json; charset=utf-8
JSON object 404
text/html; charset=utf-8
directorname + " not found"
https://popcornpal-32d285ffbdf8.herokuapp.com/directors/James Cameron
{
"Name": "James Cameron",
"Bio": "James Cameron is a Canadian filmmaker known for his expansive vision and innovative special-effects films, most notably Titanic (1997), and Avatar (2009).",
"Birthdate": "1954-08-16T00:00:00.000Z"
}
GET
/users/{username}
(gets data about a specific user)
Name Data Type Description username
string Users username
Auth Type Value Description Bearer Token
string JWT Token
HTTP Code Content-Type Response 200
application/json; charset=utf-8
JSON object 404
text/html; charset=utf-8
"User with username" + username + " not found"
401
text/plain; charset=utf-8
"Unauthorized"
https://popcornpal-32d285ffbdf8.herokuapp.com/users/johndoe
{
"_id": "6262a50dc4d247589f699b38ab9204f4",
"Username": "johndoe",
"Password": "$2b$12$q3lFXBytAOfnH5mXYll.AOH6rnNmXzbEmtsK61jUONaCW02wKz11W",
"Email": "johndoe@exmaple.com",
"Birthday": "1997-03-20T00:00:00.000Z",
"Favorites": [],
"__v": 0
},
POST
/login
(authenticates a user and returns a JWT token)
Key Value Description Username
string User username Password
string User password
HTTP Code Content-Type Response 200
application/json; charset=utf-8
JSON object of objects 401
text/html; charset=utf-8
"Invalid username or password"
https://popcornpal-32d285ffbdf8.herokuapp.com/login?Username=johndoe&Password=password123
{
"user": {
"_id": "6262a50dc4d247589f699b38ab9204f4",
"Username": "johndoe",
"Password": "$2b$12$q3lFXBytAOfnH5mXYll.AOH6rnNmXzbEmtsK61jUONaCW02wKz11W",
"Email": "johndoe@exmaple.com",
"Birthday": "1997-03-20T00:00:00.000Z",
"Favorites": [],
"__v": 0
},
"token": "Lmi97X7rSYyEVywRuee2sYlODgI0W7pFpAscfOPggAuwe6CaCi7WumymeBzH8bUm8JS9TKu4fD88VB42E1HO9Qe8fiLOJbfPtFq1taGtdV4rzoCxZ4L3AdEPwVexWSGAESVjIRRlCc7e84ChB5V5i19iZmGtulGfwXTQ-rrihSqU0-p4CsMXfommD79Qqehtgv-6JlzZcILXc-WOsSBkSCVMoTW5p6ppVPZH"
}