简体   繁体   中英

How to get more result than default ten results from API in node.js?

I have an simple express app. I want to get twenty results from API at each time. This is API http://www.omdbapi.com/ that i use. Whenever i make the call each time, i get ten results. How do i get twenty results for each call efficiently? This is my code:

exports.getMovieFromApi = async (req, res) => {

  const response = await axios.get(
    http://www.omdbapi.com/?apikey=${process.env.API_KEY}&s=${req.query.s}&page=${req.query.page}
  );
 
  res.status(200).json({
    data: JSON.parse(JSON.stringify(response.data)),
  });
};

I don't think there is a parameter for page size. I can see that they have an open ticket: https://github.com/omdbapi/OMDb-API/issues/221

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM