forked from dev-bhavya/nitj-website-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.js
140 lines (127 loc) · 5.61 KB
/
routes.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
const express = require("express");
const mainRouter = express.Router();
const navBarRouter = require("./routes/navbar");
const newsRouter = require("./routes/news");
const latestEvents = require("./routes/latestEvent");
const administrationRouter = require("./routes/administration");
const resourceRouter = require("./routes/resource");
const noticeRouter = require("./routes/notice");
const rankingRouter = require("./routes/ranking");
const placementStatRouter = require("./routes/placementStat");
const instituteProspectusLinkRouter = require("./routes/instituteProspectusLink");
const yearlyRankingRouter = require("./routes/yearlyRanking");
const timelineRouter = require("./routes/timeline");
const publicationRouter = require("./routes/publication");
const academicCalendarRouter = require("./routes/academicCalendar");
const tenderRouter = require("./routes/tender");
const reasearchHighlights = require("./routes/researchHighlights");
const photoGalleryRouter = require("./routes/photoGallery");
const footerRouter = require("./routes/footer");
const aboutRouter = require("./routes/about");
const testimonialRouter = require("./routes/testimonial");
const specialCentresRouter = require("./routes/specialCentres");
const studentTeamRouter = require("./routes/studentTeam");
const academicnoticesRouter = require("./routes/academicnotices");
const studyProgramRouter = require("./routes/studyprog");
const clubRouter = require("./routes/club");
const upcomingEventRouter = require("./routes/upcomingEvent");
const departmentRouter = require("./routes/departement");
const searchRouter = require("./routes/search");
const newpageRouter = require("./routes/newpage");
const hostelRouter = require("./routes/hostel");
const proctorialCellRouter = require("./routes/proctorialCell");
const upload = require("./routes/upload");
const store = require("./routes/store");
const admissionsRoutes = require("./routes/admissionsRoutes");
const researchRoutes = require("./routes/researchRoutes");
const recruitmentsRoutes = require("./routes/recruitmentRoutes");
const curriculumRouter = require("./routes/curriculum");
const deptCalendarRouter = require("./routes/deptCalendar");
const examinationRouter = require("./routes/examination");
const adminPath = "dashboard";
// The endpoint for the admin panel which used a non-GET request must be added to this array
const allowedNonGetRoutes = [
"/api/store",
"/api/store/*",
"/api/navbar/delete",
"/api/navbar/edit",
"/api/navbar/sort",
"/api/navbar/update",
"/api/upload",
];
mainRouter.use("/*", (req, res, next) => {
if (req.method === "GET") {
next();
} else {
if (req.headers.authorization === process.env.SECRET_KEY || req.baseUrl.startsWith("/api/dept/")) {
next();
} else {
res.status(403).json({ message: "Unauthorized" });
}
}
});
// mainRouter.route('/*').post(verifyUser).put(verifyUser).delete(verifyUser);
mainRouter.use("/navbar", navBarRouter);
mainRouter.use("/news", newsRouter);
mainRouter.use("/latestEvent", latestEvents);
mainRouter.use("/administration", administrationRouter);
mainRouter.use("/notice", noticeRouter);
mainRouter.use("/ranking", rankingRouter);
mainRouter.use("/placementStat", placementStatRouter);
mainRouter.use("/instituteProspectusLink", instituteProspectusLinkRouter);
mainRouter.use("/yearlyRanking", yearlyRankingRouter);
mainRouter.use("/timeline", timelineRouter);
mainRouter.use("/publication", publicationRouter);
mainRouter.use("/academicnotices", academicnoticesRouter);
mainRouter.use("/specialCentres", specialCentresRouter);
mainRouter.use("/tender", tenderRouter);
mainRouter.use("/studyprogramme", studyProgramRouter);
mainRouter.use("/researchHighlights", reasearchHighlights);
mainRouter.use("/photoGallery", photoGalleryRouter);
mainRouter.use("/footer", footerRouter);
mainRouter.use("/about", aboutRouter);
mainRouter.use("/testimonial", testimonialRouter);
mainRouter.use("/studentTeam", studentTeamRouter);
mainRouter.use("/club", clubRouter);
mainRouter.use("/upcomingEvent", upcomingEventRouter);
mainRouter.use("/academicCalendar", academicCalendarRouter);
mainRouter.use("/examination", examinationRouter);
mainRouter.use("/deptCalendar", deptCalendarRouter);
mainRouter.use("/curriculum", curriculumRouter);
mainRouter.use("/search", searchRouter);
mainRouter.use("/dept", departmentRouter);
mainRouter.use("/newpage", newpageRouter);
mainRouter.use("/resource", resourceRouter);
mainRouter.use("/upload", upload);
mainRouter.use("/hostel", hostelRouter);
mainRouter.use("/proctorialCell", proctorialCellRouter);
mainRouter.use("/store", store);
mainRouter.use("/admissions", admissionsRoutes);
mainRouter.use("/research", researchRoutes);
mainRouter.use("/recruitments", recruitmentsRoutes);
mainRouter.get(`/${adminPath}/ckeditor`, (req, res) => {
res.sendFile(__dirname + "/public/add.html");
});
mainRouter.get(`/${adminPath}/upload`, (req, res) => {
res.sendFile(__dirname + "/public/upload.html");
});
mainRouter.get(`/${adminPath}/store/add`, (req, res) => {
res.sendFile(__dirname + "/public/add.html");
});
mainRouter.get(`/${adminPath}/store`, (req, res) => {
res.sendFile(__dirname + "/public/show.html");
});
// mainRouter.get('/${adminPath}/newpage/edit/:id',(req,res)=>{
// res.sendFile(__dirname + '/public/edit.html');
// })
mainRouter.get(`/${adminPath}/store/edit/:id`, (req, res) => {
res.sendFile(__dirname + "/public/edit.html");
});
mainRouter.get(`/${adminPath}/navbar`, (req, res) => {
res.sendFile(__dirname + "/public/navbar.html");
});
mainRouter.get(`/${adminPath}/navbar/add`, (req, res) => {
res.sendFile(__dirname + "/public/navbaradd.html");
});
//Export----------------------------->
module.exports = mainRouter;