Added endpoints for discover media (either movie or show), getUpcoming movies, nowPlaying (movies or shows), popular (movie or show) and search similar where the type movie/show must be defined
This commit is contained in:
21
seasoned_api/src/webserver/controllers/tmdb/getUpcoming.js
Normal file
21
seasoned_api/src/webserver/controllers/tmdb/getUpcoming.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const configuration = require('src/config/configuration').getInstance();
|
||||
const TMDB = require('src/tmdb/tmdb');
|
||||
const tmdb = new TMDB(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;
|
||||
Reference in New Issue
Block a user