diff --git a/backend/routes/contactUsRouter.js b/backend/routes/contactUsRouter.js index 9871cf8..4935d32 100644 --- a/backend/routes/contactUsRouter.js +++ b/backend/routes/contactUsRouter.js @@ -1,7 +1,17 @@ const express = require("express"); const router = express.Router(); const { createContactUs } = require("../controller/contact.controller"); +const { validationResult } = require("express-validator"); -router.post("/contactus", createContactUs); +// Error handling middleware +router.use((err, req, res, next) => { + console.error(err.stack); + res.status(500).json({ + status: "error", + message: "An error occurred processing your request" + }); +}); + +router.post("/contactus", createContactUs); module.exports = router;