Skip to content

suriyaaap13/Movie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Movie

An API that allows its users to retrive movie list, rate a movie and view all movies title along with their respective ratings

Table of Contents

  • Generalinfo
  • Technology
  • API reference
  • Setup
  • Functionality
  • status

Introduction

The Application helps users to rate their favourite movies through API calls. Express is used with Node.js due to its fast, unopinionated, minimalist web framework. MongoDB used to store data of users and the movies due to its avaliability of large range of Schema and ease to use.

Technology

1. Node.js
2. Express
3. MongoDB
4. Mongoose

API reference

A list of 50 movies data has been fetched from "The Movie Database API". This link is used to create the movies in the local database.

        https://api.themoviedb.org/4/list/{list_id}?page={page_no}&api_key=<<api_key>>

with the following entries list_id = 10 and page_no = 1, 2 ,3 (3 pages of data has been collected)

Setup

Make sure that Node.js, Mongodb, robo3T, VS Code(any text editor) and Postman are installed in your local system. Open the terminal and type the following commands

  • npm install --save-dev nodemon
  • npm install
  • create a .env file in the root of the project
  • Register in
https://developers.themoviedb.org/3/getting-started/introduction and get your own API_KEY
  • Paste the following in your .env file API_KEY = <> ACCESS_TOKEN_SECRET = <>
  • To run the project type npm start in the terminal

Functionality

Register User

    To Register a new user post request has to be sent to /api/user/register with _name, email and password_ 
    in the request body. Onece the registration is done the user is created and can continue to login. The 
    following image give a picture of registration request.<br/>

Register User

Login User

    Once the user is register the user can send a post request to /api/user/login with _email and password_ 
    in the request body. On a successful login the user will be given an accesstoken(The accessToken expires 
    after 5mintues) which can be used to retrive movie list and rate a movie.Note: The following picture paints 
    the image of the above statements..<br/>

Login User

Fetch Movie List

    To retrive movie list send a post request to /api/movie/list with header holding the value of accessToken
    against key auth-token. The accessToken expires after 5mins so may get a Forbidden error, in that case login
    again and generate a new token and replace the header with the new token. Refer to below image incase of any doubts.

Retrive Movie LIst

Rate a Movie

    Copy the id of a movie that you want to rate, paste the id in params against key id(reger image), in the Header
    section paste the access token against key "auth-token", add the rating(from 1-10) you wish to give to the movie
    in the body against key "rating" and send a post request to /api/movie/rate/:id . If the accessToken is expired
    you will get a "Forbidden Error" in that case generate a new accessToken and paste it in the Header. <br/>

Rate a Movie Rate Movie Header Rate Movie Body

Open List

    This is an open API that shows the list of movies in the list along with their rating, if there was no ratings
    present it will be marked with a **NA** (Not Attempted) tag.

Open List

Status

This project is completely developed and has all required functionality. 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published