Added monitor router, controller, and model

This commit is contained in:
Alex Holliday committed 2024-05-10 13:36:04 -07:00
1 parent 0abda6fd21
commit def8ba4b9d
5 files changed
+96 -26

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
const { getMonitorsByIdValidation } = require("../validation/joi");
const getAllMonitors = async (req, res) => {
res.json({ message: "Hello from Monitor Controller" });
};
const getMonitorById = async (req, res) => {
const { error } = getMonitorsByIdValidation.validate(req.params);
if (error) {
return res
.status(400)
.json({ success: false, msg: error.details[0].message });
}
const monitorId = req.params.monitorId;
return res.json({ success: true, msg: "Monitor found", data: { monitorId } });
};
module.exports = { getAllMonitors, getMonitorById };