If search request returns empty array from tmdb, then send a 404 repo… #12

Merged
KevinMidboe merged 1 commits from api into master 2017-07-01 06:37:54 +00:00

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) => {