CourseForm backend done
This commit is contained in:
@@ -1,11 +1,200 @@
|
||||
// import React, { useState, useEffect } from "react";
|
||||
// import { useLocation, useParams, useNavigate } from "react-router-dom";
|
||||
// import "./CourseForm.css";
|
||||
|
||||
// const CourseForm = () => {
|
||||
// const { id } = useParams(); // Get the course ID from the URL params
|
||||
// const location = useLocation();
|
||||
// const navigate = useNavigate(); // Updated for navigation
|
||||
// const { course } = location.state || {};
|
||||
|
||||
// const [options, setOptions] = useState({
|
||||
// assessment: [],
|
||||
// reassessment: [],
|
||||
// paperSetting: [],
|
||||
// moderation: [],
|
||||
// pwdPaperSetter: [],
|
||||
// oralsPracticals: [], // New field for Orals/Practicals
|
||||
// });
|
||||
|
||||
// const [formData, setFormData] = useState({
|
||||
// assessment: "",
|
||||
// reassessment: "",
|
||||
// paperSetting: "",
|
||||
// moderation: "",
|
||||
// pwdPaperSetter: "",
|
||||
// oralsPracticals: "", // New field for Orals/Practicals
|
||||
// });
|
||||
|
||||
// const [errors, setErrors] = useState({}); // To track validation errors
|
||||
|
||||
// // Fetch data for search bars
|
||||
// useEffect(() => {
|
||||
// const fetchOptions = async () => {
|
||||
// try {
|
||||
// const response = await fetch("/api/options"); // Replace with your API endpoint
|
||||
// const data = await response.json();
|
||||
// setOptions(data);
|
||||
// } catch (error) {
|
||||
// console.error("Failed to fetch options:", error);
|
||||
// }
|
||||
// };
|
||||
|
||||
// fetchOptions();
|
||||
// }, []);
|
||||
|
||||
// const handleInputChange = (e) => {
|
||||
// const { name, value } = e.target;
|
||||
// setFormData({ ...formData, [name]: value });
|
||||
// };
|
||||
|
||||
// const validateForm = () => {
|
||||
// const newErrors = {};
|
||||
// Object.keys(formData).forEach((field) => {
|
||||
// if (!formData[field]) {
|
||||
// newErrors[field] = "This field is required";
|
||||
// }
|
||||
// });
|
||||
// setErrors(newErrors);
|
||||
// return Object.keys(newErrors).length === 0;
|
||||
// };
|
||||
|
||||
// const handleSubmit = (e) => {
|
||||
// e.preventDefault();
|
||||
// if (validateForm()) {
|
||||
// console.log("Form submitted:", formData);
|
||||
|
||||
// navigate("/courses", { state: { updatedCourse: { ...course, status: "Submitted" } } });
|
||||
// }
|
||||
// };
|
||||
|
||||
// return (
|
||||
// <div className="form-container">
|
||||
// <h2>Course Info</h2>
|
||||
// <form onSubmit={handleSubmit}>
|
||||
// <label>
|
||||
// Course ID:
|
||||
// <input type="text" value={course?.id || id} readOnly />
|
||||
// </label>
|
||||
// <label>
|
||||
// Course Name:
|
||||
// <input type="text" value={course?.name || ""} readOnly />
|
||||
// </label>
|
||||
// <label className={errors.oralsPracticals ? "error" : ""}>
|
||||
// Orals/Practicals:
|
||||
// <input
|
||||
// type="text"
|
||||
// name="oralsPracticals"
|
||||
// list="oralsPracticals-options"
|
||||
// value={formData.oralsPracticals}
|
||||
// onChange={handleInputChange}
|
||||
// />
|
||||
// <datalist id="oralsPracticals-options">
|
||||
// {options.oralsPracticals.map((option, index) => (
|
||||
// <option key={index} value={option} />
|
||||
// ))}
|
||||
// </datalist>
|
||||
// {errors.oralsPracticals && <span className="error-message">{errors.oralsPracticals}</span>}
|
||||
// </label>
|
||||
// <label className={errors.assessment ? "error" : ""}>
|
||||
// Assessment:
|
||||
// <input
|
||||
// type="text"
|
||||
// name="assessment"
|
||||
// list="assessment-options"
|
||||
// value={formData.assessment}
|
||||
// onChange={handleInputChange}
|
||||
// />
|
||||
// <datalist id="assessment-options">
|
||||
// {options.assessment.map((option, index) => (
|
||||
// <option key={index} value={option} />
|
||||
// ))}
|
||||
// </datalist>
|
||||
// {errors.assessment && <span className="error-message">{errors.assessment}</span>}
|
||||
// </label>
|
||||
// <label className={errors.reassessment ? "error" : ""}>
|
||||
// Reassessment:
|
||||
// <input
|
||||
// type="text"
|
||||
// name="reassessment"
|
||||
// list="reassessment-options"
|
||||
// value={formData.reassessment}
|
||||
// onChange={handleInputChange}
|
||||
// />
|
||||
// <datalist id="reassessment-options">
|
||||
// {options.reassessment.map((option, index) => (
|
||||
// <option key={index} value={option} />
|
||||
// ))}
|
||||
// </datalist>
|
||||
// {errors.reassessment && <span className="error-message">{errors.reassessment}</span>}
|
||||
// </label>
|
||||
// <label className={errors.paperSetting ? "error" : ""}>
|
||||
// Paper Setting:
|
||||
// <input
|
||||
// type="text"
|
||||
// name="paperSetting"
|
||||
// list="paperSetting-options"
|
||||
// value={formData.paperSetting}
|
||||
// onChange={handleInputChange}
|
||||
// />
|
||||
// <datalist id="paperSetting-options">
|
||||
// {options.paperSetting.map((option, index) => (
|
||||
// <option key={index} value={option} />
|
||||
// ))}
|
||||
// </datalist>
|
||||
// {errors.paperSetting && <span className="error-message">{errors.paperSetting}</span>}
|
||||
// </label>
|
||||
// <label className={errors.moderation ? "error" : ""}>
|
||||
// Moderation:
|
||||
// <input
|
||||
// type="text"
|
||||
// name="moderation"
|
||||
// list="moderation-options"
|
||||
// value={formData.moderation}
|
||||
// onChange={handleInputChange}
|
||||
// />
|
||||
// <datalist id="moderation-options">
|
||||
// {options.moderation.map((option, index) => (
|
||||
// <option key={index} value={option} />
|
||||
// ))}
|
||||
// </datalist>
|
||||
// {errors.moderation && <span className="error-message">{errors.moderation}</span>}
|
||||
// </label>
|
||||
// <label className={errors.pwdPaperSetter ? "error" : ""}>
|
||||
// PwD Paper Setter:
|
||||
// <input
|
||||
// type="text"
|
||||
// name="pwdPaperSetter"
|
||||
// list="pwdPaperSetter-options"
|
||||
// value={formData.pwdPaperSetter}
|
||||
// onChange={handleInputChange}
|
||||
// />
|
||||
// <datalist id="pwdPaperSetter-options">
|
||||
// {options.pwdPaperSetter.map((option, index) => (
|
||||
// <option key={index} value={option} />
|
||||
// ))}
|
||||
// </datalist>
|
||||
// {errors.pwdPaperSetter && <span className="error-message">{errors.pwdPaperSetter}</span>}
|
||||
// </label>
|
||||
// <button type="submit" disabled={Object.keys(errors).length > 0}>Submit</button>
|
||||
// </form>
|
||||
// </div>
|
||||
// );
|
||||
// };
|
||||
|
||||
// export default CourseForm;
|
||||
|
||||
// CourseForm.jsx
|
||||
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { useLocation, useParams, useNavigate } from "react-router-dom";
|
||||
import { fetchFaculties } from "../api";
|
||||
import "./CourseForm.css";
|
||||
|
||||
const CourseForm = () => {
|
||||
const { id } = useParams(); // Get the course ID from the URL params
|
||||
const { id } = useParams();
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate(); // Updated for navigation
|
||||
const navigate = useNavigate();
|
||||
const { course } = location.state || {};
|
||||
|
||||
const [options, setOptions] = useState({
|
||||
@@ -14,7 +203,8 @@ const CourseForm = () => {
|
||||
paperSetting: [],
|
||||
moderation: [],
|
||||
pwdPaperSetter: [],
|
||||
oralsPracticals: [], // New field for Orals/Practicals
|
||||
oralsPracticals: [],
|
||||
faculties: [], // New field for faculties
|
||||
});
|
||||
|
||||
const [formData, setFormData] = useState({
|
||||
@@ -26,21 +216,23 @@ const CourseForm = () => {
|
||||
oralsPracticals: "", // New field for Orals/Practicals
|
||||
});
|
||||
|
||||
const [errors, setErrors] = useState({}); // To track validation errors
|
||||
const [errors, setErrors] = useState({});
|
||||
|
||||
// Fetch data for search bars
|
||||
useEffect(() => {
|
||||
const fetchOptions = async () => {
|
||||
const fetchOptionsAndFaculties = async () => {
|
||||
try {
|
||||
const response = await fetch("/api/options"); // Replace with your API endpoint
|
||||
const data = await response.json();
|
||||
setOptions(data);
|
||||
const facultiesData = await fetchFaculties(); // Fetch faculty names from the backend
|
||||
console.log(facultiesData);
|
||||
setOptions(prevOptions => ({
|
||||
...prevOptions,
|
||||
faculties: facultiesData,
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error("Failed to fetch options:", error);
|
||||
console.error("Failed to fetch faculties:", error);
|
||||
}
|
||||
};
|
||||
|
||||
fetchOptions();
|
||||
fetchOptionsAndFaculties();
|
||||
}, []);
|
||||
|
||||
const handleInputChange = (e) => {
|
||||
@@ -59,15 +251,30 @@ const CourseForm = () => {
|
||||
return Object.keys(newErrors).length === 0;
|
||||
};
|
||||
|
||||
// const handleSubmit = (e) => {
|
||||
// e.preventDefault();
|
||||
// if (validateForm()) {
|
||||
// console.log("Form submitted:", formData);
|
||||
// navigate("/courses", { state: { updatedCourse: { ...course, status: "Submitted" } } });
|
||||
// }
|
||||
// };
|
||||
const handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
if (validateForm()) {
|
||||
console.log("Form submitted:", formData);
|
||||
|
||||
navigate("/courses", { state: { updatedCourse: { ...course, status: "Submitted" } } });
|
||||
navigate("/courses", {
|
||||
state: {
|
||||
updatedCourse: {
|
||||
...course,
|
||||
status: "Submitted", // Update status
|
||||
...formData, // Include form data if required
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<div className="form-container">
|
||||
<h2>Course Info</h2>
|
||||
@@ -91,7 +298,7 @@ const CourseForm = () => {
|
||||
/>
|
||||
<datalist id="oralsPracticals-options">
|
||||
{options.oralsPracticals.map((option, index) => (
|
||||
<option key={index} value={option} />
|
||||
<option key={index} value={option.name} />
|
||||
))}
|
||||
</datalist>
|
||||
{errors.oralsPracticals && <span className="error-message">{errors.oralsPracticals}</span>}
|
||||
@@ -107,7 +314,7 @@ const CourseForm = () => {
|
||||
/>
|
||||
<datalist id="assessment-options">
|
||||
{options.assessment.map((option, index) => (
|
||||
<option key={index} value={option} />
|
||||
<option key={index} value={option.name} />
|
||||
))}
|
||||
</datalist>
|
||||
{errors.assessment && <span className="error-message">{errors.assessment}</span>}
|
||||
@@ -123,7 +330,7 @@ const CourseForm = () => {
|
||||
/>
|
||||
<datalist id="reassessment-options">
|
||||
{options.reassessment.map((option, index) => (
|
||||
<option key={index} value={option} />
|
||||
<option key={index} value={option.name} />
|
||||
))}
|
||||
</datalist>
|
||||
{errors.reassessment && <span className="error-message">{errors.reassessment}</span>}
|
||||
@@ -139,7 +346,7 @@ const CourseForm = () => {
|
||||
/>
|
||||
<datalist id="paperSetting-options">
|
||||
{options.paperSetting.map((option, index) => (
|
||||
<option key={index} value={option} />
|
||||
<option key={index} value={option.name} />
|
||||
))}
|
||||
</datalist>
|
||||
{errors.paperSetting && <span className="error-message">{errors.paperSetting}</span>}
|
||||
@@ -155,7 +362,7 @@ const CourseForm = () => {
|
||||
/>
|
||||
<datalist id="moderation-options">
|
||||
{options.moderation.map((option, index) => (
|
||||
<option key={index} value={option} />
|
||||
<option key={index} value={option.name} />
|
||||
))}
|
||||
</datalist>
|
||||
{errors.moderation && <span className="error-message">{errors.moderation}</span>}
|
||||
@@ -171,7 +378,7 @@ const CourseForm = () => {
|
||||
/>
|
||||
<datalist id="pwdPaperSetter-options">
|
||||
{options.pwdPaperSetter.map((option, index) => (
|
||||
<option key={index} value={option} />
|
||||
<option key={index} value={option.name} />
|
||||
))}
|
||||
</datalist>
|
||||
{errors.pwdPaperSetter && <span className="error-message">{errors.pwdPaperSetter}</span>}
|
||||
|
||||
@@ -1,69 +1,105 @@
|
||||
// import React from "react";
|
||||
// import { useNavigate } from "react-router-dom";
|
||||
// import React, { useState, useEffect } from 'react';
|
||||
// import { useLocation, useNavigate } from "react-router-dom";
|
||||
// import "./CourseTable.css";
|
||||
// import { fetchCourses } from '../api';
|
||||
|
||||
// const CourseTable = ({courses}) => {
|
||||
// const navigate = useNavigate();
|
||||
// const CourseTable = () => {
|
||||
// const { state } = useLocation();
|
||||
// const courses = state?.courses;
|
||||
// const navigate= useNavigate();
|
||||
// console.log(courses);
|
||||
|
||||
// useEffect(() => {
|
||||
// if (!courses || courses.length === 0) {
|
||||
// alert("No courses available");
|
||||
// }
|
||||
// }, [courses]);
|
||||
|
||||
// if (!courses) {
|
||||
// return <div>Loading...</div>;
|
||||
// }
|
||||
|
||||
// const handleRowClick = (course) => {
|
||||
// navigate(`/course-form/${course.id}`, { state: { course } });
|
||||
// navigate(`/course-form/${course.courseId}`, { state: { course } });
|
||||
// };
|
||||
|
||||
// return (
|
||||
// <div className="course-table">
|
||||
// <h1>Courses</h1>
|
||||
// <table border="1">
|
||||
// <table className="course-table">
|
||||
// <thead>
|
||||
// <tr>
|
||||
// <th>Course ID</th>
|
||||
// <th>CourseID</th>
|
||||
// <th>Course Name</th>
|
||||
// <th>Status</th>
|
||||
// </tr>
|
||||
// </thead>
|
||||
// <tbody>
|
||||
// {courses.map((course) => (
|
||||
// <tr
|
||||
// key={course.id}
|
||||
// onClick={() => handleRowClick(course)}
|
||||
// style={{ cursor: "pointer" }}
|
||||
// >
|
||||
// <td>{course.id}</td>
|
||||
// {courses.map(course => (
|
||||
// <tr key={course.courseId} onClick={() => handleRowClick(course)}>
|
||||
// <td>{course.courseId}</td>
|
||||
// <td>{course.name}</td>
|
||||
// <td>
|
||||
// <span className={`status ${course.status.replace(" ", "-")}`}>
|
||||
// {course.status}
|
||||
// </span>
|
||||
// </td>
|
||||
// <td>{course.status}</td>
|
||||
// </tr>
|
||||
// ))}
|
||||
// </tbody>
|
||||
// </table>
|
||||
// </div>
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
|
||||
// export default CourseTable;
|
||||
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
import "./CourseTable.css";
|
||||
import { fetchCourses } from '../api';
|
||||
import { fetchCourses } from "../api";
|
||||
|
||||
const CourseTable = () => {
|
||||
const { state } = useLocation();
|
||||
const courses = state?.courses;
|
||||
console.log(courses);
|
||||
const [courses, setCourses] = useState(state?.courses || []);
|
||||
const [loading, setLoading] = useState(!state?.courses);
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
if (!courses || courses.length === 0) {
|
||||
alert("No courses available");
|
||||
const fetchAllCourses = async () => {
|
||||
if (!state?.courses) {
|
||||
try {
|
||||
const fetchedCourses = await fetchCourses(); // Fetch courses from API
|
||||
setCourses(fetchedCourses);
|
||||
} catch (error) {
|
||||
console.error("Failed to fetch courses:", error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, [courses]);
|
||||
}
|
||||
};
|
||||
|
||||
if (!courses) {
|
||||
fetchAllCourses();
|
||||
}, [state?.courses]);
|
||||
|
||||
useEffect(() => {
|
||||
if (state?.updatedCourse) {
|
||||
setCourses((prevCourses) => {
|
||||
// Filter only the updated course
|
||||
const filteredCourses = prevCourses.filter((course) =>
|
||||
course.courseId === state.updatedCourse.courseId
|
||||
);
|
||||
|
||||
return filteredCourses.map((course) =>
|
||||
course.courseId === state.updatedCourse.courseId
|
||||
? { ...course, status: "Submitted" } // Update status
|
||||
: course
|
||||
);
|
||||
});
|
||||
}
|
||||
}, [state?.updatedCourse]);
|
||||
|
||||
if (loading) {
|
||||
return <div>Loading...</div>;
|
||||
}
|
||||
|
||||
const handleRowClick = (course) => {
|
||||
navigate(`/course-form/${course.courseId}`, { state: { course } });
|
||||
};
|
||||
|
||||
return (
|
||||
<table className="course-table">
|
||||
<thead>
|
||||
@@ -74,16 +110,22 @@ const CourseTable = () => {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{courses.map(course => (
|
||||
<tr key={course.id}>
|
||||
{courses.length > 0 ? (
|
||||
courses.map((course) => (
|
||||
<tr key={course.courseId} onClick={() => handleRowClick(course)}>
|
||||
<td>{course.courseId}</td>
|
||||
<td>{course.name}</td>
|
||||
<td>{course.status}</td>
|
||||
</tr>
|
||||
))}
|
||||
))
|
||||
) : (
|
||||
<tr>
|
||||
<td colSpan="3">No courses available</td>
|
||||
</tr>
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default CourseTable;
|
||||
|
||||
@@ -12,8 +12,8 @@ const Welcom = () => {
|
||||
return (
|
||||
<div className="welcom-container">
|
||||
<div className="welcom-message">
|
||||
<h1>Welcome, John Doe</h1>
|
||||
<p>You're signed in as DEC/EIC</p>
|
||||
<h1>Welcome</h1>
|
||||
<p>You're signed in</p>
|
||||
</div>
|
||||
<button className="next-button" onClick={goToFilterPage}>
|
||||
Proceed
|
||||
|
||||
@@ -86,8 +86,8 @@ const WelcomeWithFilter = () => {
|
||||
// Default welcome content
|
||||
<div className="welcome-content">
|
||||
<div className="welcome-message">
|
||||
<h1>Welcome, John Doe</h1>
|
||||
<p>You’re signed in as DEC/EIC</p>
|
||||
<h1>Welcome</h1>
|
||||
<p>You’re signed in</p>
|
||||
</div>
|
||||
<div className="image-container">
|
||||
<img
|
||||
|
||||
@@ -26,3 +26,30 @@ export const fetchCourses = async (filterData) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const fetchFaculties = async () => {
|
||||
try {
|
||||
const response = await fetch(`${BASE_URL}/faculty`);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch faculties: ${response.statusText}`);
|
||||
}
|
||||
const data = await response.json();
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error("Error fetching faculties:", error.message);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
export const fetchOptions = async () => {
|
||||
try {
|
||||
const response = await fetch(`${BASE_URL}/options`);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch options: ${response.statusText}`);
|
||||
}
|
||||
const data = await response.json();
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error("Error fetching options:", error.message);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
13
server/controller/facultyController.js
Normal file
13
server/controller/facultyController.js
Normal 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" });
|
||||
}
|
||||
};
|
||||
@@ -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" });
|
||||
}
|
||||
});
|
||||
|
||||
37
server/routes/optionsRoutes.js
Normal file
37
server/routes/optionsRoutes.js
Normal file
@@ -0,0 +1,37 @@
|
||||
// const express = require('express');
|
||||
// const router = express.Router();
|
||||
|
||||
// // Sample data (replace this with actual data fetching logic)
|
||||
// const optionsData = {
|
||||
// assessment: ["Option 1", "Option 2", "Option 3"],
|
||||
// reassessment: ["Option A", "Option B"],
|
||||
// paperSetting: ["Option X", "Option Y"],
|
||||
// moderation: ["Option M", "Option N"],
|
||||
// pwdPaperSetter: ["Option P", "Option Q"],
|
||||
// oralsPracticals: ["Option O", "Option P"]
|
||||
// };
|
||||
|
||||
// // GET route for fetching options
|
||||
// router.get('/', (req, res) => {
|
||||
// res.status(200).json(optionsData);
|
||||
// });
|
||||
|
||||
// module.exports = router;
|
||||
|
||||
|
||||
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;
|
||||
@@ -16,6 +16,7 @@ const PasswordRouter = require("./routes/authRoutes");
|
||||
const courseRoutes = require("./routes/courseRoutes");
|
||||
const facultyRoutes = require("./routes/facultyRoutes");
|
||||
const appointmentRoutes = require("./routes/appointmentRoutes");
|
||||
const optionsRoutes = require("./routes/optionsRoutes");
|
||||
|
||||
// Existing Database Connection
|
||||
const { connectdb } = require("./ConnectionDb");
|
||||
@@ -92,6 +93,7 @@ app.use("/password", PasswordRouter);
|
||||
app.use("/api/courses", courseRoutes);
|
||||
app.use("/api/faculty", facultyRoutes);
|
||||
app.use("/api/appointments", appointmentRoutes);
|
||||
app.use("/api/options", optionsRoutes);
|
||||
|
||||
// OAuth Routes
|
||||
app.get(
|
||||
@@ -200,6 +202,8 @@ app.get("*", (req, res) =>
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
// Start Server
|
||||
const Port = process.env.PORT || 8080;
|
||||
app.listen(Port, () => {
|
||||
|
||||
Reference in New Issue
Block a user