Merge pull request #12 from KevinMidboe/api

If search request returns empty array from tmdb, then send a 404 repo…
This commit is contained in:
2017-07-01 08:37:53 +02:00
committed by GitHub

View File

@@ -14,6 +14,11 @@ function searchMoviesController(req, res) {
Promise.resolve()
.then(() => tmdb.search(query, page, type))
.then((movies) => {
if (movies.length > 0) {
res.send(movies);
} else {
res.status(404).send({ success: false, error: 'Search query did not return any results.'})
}
res.send(movies);
})
.catch((error) => {