diff --git a/src/pages/api/ratemyprofessorScraper.ts b/src/pages/api/ratemyprofessorScraper.ts index 6a5a11c..e60f40c 100644 --- a/src/pages/api/ratemyprofessorScraper.ts +++ b/src/pages/api/ratemyprofessorScraper.ts @@ -146,10 +146,14 @@ export default function handler( maxRatingsProfessor = professors[i]; } } - res.status(200).json({ - message: 'success', - data: maxRatingsProfessor.node, - }); + if (maxRatingsProfessor.node.numRatings > 0) { + res.status(200).json({ + message: 'success', + data: maxRatingsProfessor.node, + }); + } else { + res.status(400).json({ message: 'Data for professor not found' }); + } resolve(); return; })