Skip to content

Commit

Permalink
updated genre.js API
Browse files Browse the repository at this point in the history
  • Loading branch information
Dead-Stone committed Dec 5, 2023
1 parent 68aa8e7 commit 4c01d44
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions server/routes/genre.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,16 @@ router.get('/', async (req, res) => {
}
});

router.get('/:name', async (req, res) => {
try {
const genre = await Genre.findOne({ name: req.params.name });
if (!genre) return res.status(404).json({ message: 'Genre not found' });
res.json(genre);
} catch (error) {
res.status(500).json({ message: error.message });
}
});



module.exports = router;

0 comments on commit 4c01d44

Please sign in to comment.