CourseForm backend done

This commit is contained in:
Harshitha Shetty
2024-12-09 07:26:57 +05:30
parent e22727eefd
commit ce73a591c5
9 changed files with 408 additions and 76 deletions

View File

@@ -0,0 +1,13 @@
const db = require('../ConnectionDb'); // Import your database module
const Faculty = require('../models/Faculty'); // Your Mongoose model for faculty
exports.getFaculties = async (req, res) => {
try {
const faculties = await Faculty.find(); // Fetch all faculty documents from the 'faculties' collection
res.status(200).json(faculties);
} catch (error) {
console.error("Error fetching faculties:", error.message);
res.status(500).json({ error: "Failed to fetch faculties" });
}
};