This is a middleware api server with partial functionality of MovieDB API. All results store in MongoDB after request, and would be received from DB after
The latest version deployed on https://mvdb-api.herokuapp.com/
3. Getting the average rating for the genre. ( You can call only one request and wait for it to complete. API does not support asynchronous call rating calculation )
$ npm install
$ npm start
Example: &sort=popularity.desc
Example: &genre=Action
Genres available ( capital letters are not important ): action, adventure, animation, comedy, crime, documentary, drama, family, fantasy, horror, history, music, mystery, romance, science fiction, tv movie, thriller, war, western
Example: &year=2015
&page
and &amount
: The variables introduced for the universality api. Allows you to mentally break all the movies into &amount and display a specific &page with these movies. (&amount
can't be more than 600, due to problems with a large number of requests to TMDB API. &amount * &page
can't be more than 20000, due to limitations of TMDB API, api does not allow to fetch 20001 movie and further )
Example: &page=2&amount=4 (will return from 5'th to 8'th movies from requested list)
2. Store movies after request as 20 movies for current params query and page. Stored movies will be used again in same request (relies on order, year, genre, page and amount are not important). If part of movies are stored in DB, the first part will be received from DB, the rest movies will be fetched from TMDB API and also stored in DB. Order of params is not important.
3. Returns json file with fields of my_id (your requested link without &amount
and with uniq calculated &page
to be able to be stored in DB), page (uniq calculated &page
), total_results, total_pages (TMDB stats), array of movies.
Example: https://mvdb-api.herokuapp.com/movie_list?sort=popularity.desc&genre=animation&year=2015&page=1&amount=70
Example: &movie_id=420818
Example: https://mvdb-api.herokuapp.com/movie_details?movie_id=420818
Start process of calculating average rating by genre. (Server iterates over all the movies for this genre. Cannot iterate over 1000 pages of 20 films due to limitations of TMDB API. Also server asynchronously iterates only 600 movies every 12 seconds due to problems with a large number of requests to TMDB API). You can start only 1 process of calculating, new request will start a new calculation.
Example: &genre=Action
2. Store calculated rating in DB. If this genre rating is already exits in db, remove elder result from DB on new request.
Example: https://mvdb-api.herokuapp.com/genre_raiting?genre=music
Example: &genre=Action
Example: https://mvdb-api.herokuapp.com/get_genre_raiting?genre=music