Api search tmdb list #53

Merged
KevinMidboe merged 5 commits from api_search-tmdb-list into master 2017-10-23 13:35:35 +00:00
5 changed files with 0 additions and 116 deletions
Showing only changes of commit 2d986eb5b3 - Show all commits

View File

@@ -1,23 +0,0 @@
const configuration = require('src/config/configuration').getInstance();
const Cache = require('src/tmdb/cache');
const TMDB = require('src/tmdb/tmdb');
const cache = new Cache();
const tmdb = new TMDB(cache, configuration.get('tmdb', 'apiKey'));
/**
* Controller: Retrieve a list of movies or shows in discover section in TMDB
* @param {Request} req http request variable
* @param {Response} res
* @returns {Callback}
*/
function discoverMediaController(req, res) {
const { page, type } = req.query;
tmdb.discover(page, type)
.then((results) => {
res.send(results);
}).catch((error) => {
res.status(404).send({ success: false, error: error.message });
});
}
module.exports = discoverMediaController;

View File

@@ -1,23 +0,0 @@
const configuration = require('src/config/configuration').getInstance();
const Cache = require('src/tmdb/cache');
const TMDB = require('src/tmdb/tmdb');
const cache = new Cache();
const tmdb = new TMDB(cache, configuration.get('tmdb', 'apiKey'));
/**
* Controller: Retrieve upcoming movies
* @param {Request} req http request variable
* @param {Response} res
* @returns {Callback}
*/
function getUpcomingController(req, res) {
const { page } = req.query;
tmdb.upcoming(page)
.then((results) => {
res.send(results);
}).catch((error) => {
res.status(404).send({ success: false, error: error.message });
});
}
module.exports = getUpcomingController;

View File

@@ -1,23 +0,0 @@
const configuration = require('src/config/configuration').getInstance();
const Cache = require('src/tmdb/cache');
const TMDB = require('src/tmdb/tmdb');
const cache = new Cache();
const tmdb = new TMDB(cache, configuration.get('tmdb', 'apiKey'));
/**
* Controller: Retrieve nowplaying movies / now airing shows
* @param {Request} req http request variable
* @param {Response} res
* @returns {Callback}
*/
function nowPlayingMediaController(req, res) {
const { page, type } = req.query;
tmdb.nowplaying(page, type)
.then((results) => {
res.send(results);
}).catch((error) => {
res.status(404).send({ success: false, error: error.message });
});
}
module.exports = nowPlayingMediaController;

View File

@@ -1,23 +0,0 @@
const configuration = require('src/config/configuration').getInstance();
const Cache = require('src/tmdb/cache');
const TMDB = require('src/tmdb/tmdb');
const cache = new Cache();
const tmdb = new TMDB(cache, configuration.get('tmdb', 'apiKey'));
/**
* Controller: Retrieve information for a movie
* @param {Request} req http request variable
* @param {Response} res
* @returns {Callback}
*/
function popularMediaController(req, res) {
const { page, type } = req.query;
tmdb.popular(page, type)
.then((results) => {
res.send(results);
}).catch((error) => {
res.status(404).send({ success: false, error: error.message });
});
}
module.exports = popularMediaController;

View File

@@ -1,24 +0,0 @@
const configuration = require('src/config/configuration').getInstance();
const Cache = require('src/tmdb/cache');
const TMDB = require('src/tmdb/tmdb');
const cache = new Cache();
const tmdb = new TMDB(cache, configuration.get('tmdb', 'apiKey'));
/**
* Controller: Retrieve similar movies or shows
* @param {Request} req http request variable
* @param {Response} res
* @returns {Callback}
*/
function similarMediaController(req, res) {
const mediaId = req.params.mediaId;
const { type } = req.query;
tmdb.similar(mediaId, type)
.then((results) => {
res.send(results);
}).catch((error) => {
res.status(404).send({ success: false, error: error.message });
});
}
module.exports = similarMediaController;