im try to make a call with a nodeJs server but the results is empty.
this is my code :
import fetch from "node-fetch";
import "dotenv/config";
export const search = async (req, res, next) => {
try {
const url = `https://api.themoviedb.org/3/search/tv?api_key=${process.env.TMDB_API_KEY}&query=${req.params.search}&language=en-US`;
const result = await fetch(url);
const data = await result.json();
return res.status(200).json(data);
} catch (err) {
return next(err);
}
};
returns:
{ page: 1, results: [], total_pages: 1, total_results: 0 }
thx for helping
Не можеш да нађеш филм или серију? Пријави се да додаш.
Желите ли да оцените или додате ову ставку у листу?
Нисте члан?
Одговор од robbie3999
дана 26. јул 2023. у 3:46 PM
Hi @itachouille, I would suspect that your query string "${req.params.search}" is empty. Try printing out the value of "url" before you fetch it.