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:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user