CourseForm backend done
This commit is contained in:
@@ -6,9 +6,10 @@ const router = express.Router();
|
||||
// Get all faculty members
|
||||
router.get("/", async (req, res) => {
|
||||
try {
|
||||
const faculty = await Faculty.find();
|
||||
res.json(faculty);
|
||||
const faculties = await Faculty.find();
|
||||
res.status(200).json(faculties);
|
||||
} catch (error) {
|
||||
console.error("Error fetching faculty members:", error.message);
|
||||
res.status(500).json({ error: "Failed to fetch faculty members" });
|
||||
}
|
||||
});
|
||||
@@ -20,8 +21,9 @@ router.get("/:id", async (req, res) => {
|
||||
if (!faculty) {
|
||||
return res.status(404).json({ error: "Faculty member not found" });
|
||||
}
|
||||
res.json(faculty);
|
||||
res.status(200).json(faculty);
|
||||
} catch (error) {
|
||||
console.error("Error fetching faculty member:", error.message);
|
||||
res.status(500).json({ error: "Failed to fetch faculty member" });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user