-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
38 lines (30 loc) · 1.16 KB
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// server.js
const express = require("express");
const mongoose = require("mongoose");
const cors = require("cors");
require("dotenv").config();
const app = express();
app.use(express.json());
app.use(cors());
function connectToMongo() {
const db_uri = process.env.DB_URI;
mongoose
.connect(db_uri)
.then(() => console.log("MongoDB Connected"))
.catch((err) => console.log(err));
}
const port = process.env.PORT || 5000;
app.listen(port, () => console.log(`Server running on port ${port}`));
connectToMongo();
const adminRoutes = require("./routes/adminRoutes");
const authRoutes = require("./routes/authRoutes");
const semesterRegistrationRoutes = require("./routes/semesterRegistrationRoutes");
const verifyFeesRoutes = require("./routes/verifyFeesRoute.js");
const fetchDocumentRoutes = require("./routes/fetchDocumentRoutes.js");
const addCommentRoutes = require("./routes/commentRoute.js");
app.use("/api/admin", adminRoutes);
app.use("/api/auth", authRoutes);
app.use("/api/registration", semesterRegistrationRoutes);
app.use("/api/verify-fees", verifyFeesRoutes);
app.use("/api/fetch-documents", fetchDocumentRoutes)
app.use("/api/comment", addCommentRoutes);