We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
You can use validation in controllers, when the user makes a search request for the parameter, it would be interesting to use the conditional.
Example in hotelController:
export const deleteHotel = async (req, res) => { try { const removeHotel = await Hotel.findByIdAndRemove(req.params.id); //You can use validate here, is check if id exists before return 200; if (!removeHotel) { return res.status(404).json({ message: "Hotel deleted" }); } return res.status(200).json("Hotel has been deleted!"); } catch (error) { return res.status(500).json(error); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
You can use validation in controllers, when the user makes a search request for the parameter, it would be interesting to use the conditional.
Example in hotelController:
export const deleteHotel = async (req, res) => {
try {
const removeHotel = await Hotel.findByIdAndRemove(req.params.id);
//You can use validate here, is check if id exists before return 200;
if (!removeHotel) {
return res.status(404).json({ message: "Hotel deleted" });
}
return res.status(200).json("Hotel has been deleted!");
} catch (error) {
return res.status(500).json(error);
}
The text was updated successfully, but these errors were encountered: