const express = require('express');
const router = express.Router();
const { getFaculties } = require('../controller/facultyController'); // Import your controller that interacts with the database

// GET route for fetching faculty names
router.get('/', async (req, res) => {
  try {
    const faculties = await getFaculties(); // Fetch faculty names from database
    res.status(200).json(faculties);
  } catch (error) {
    console.error("Error fetching faculties:", error.message);
    res.status(500).json({ error: "Failed to fetch faculties" });
  }
});

module.exports = router;
