-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserver.js
40 lines (33 loc) · 1.07 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
39
40
const express = require("express");
const bodyParser = require("body-parser");
const cors = require("cors");
const morgan = require("morgan");
const app = express();
const fs = require("fs");
const {
getData,
getGradeCard,
getAdmitCard,
forgotPassword,
getNotices,
} = require("./scraper");
app.use(cors());
app.use(morgan("dev"));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
const port = process.env.PORT || 1000;
app.listen(port, console.log(`App is running on ${port}`)).setTimeout(0);
//Test Route
app.get("/test", (req, res) => {
res.send("Hello");
});
//Get all data of the student when logging in. Data includes - Name, ImageURL, semester name and semester page url they have registered for.
app.post("/", getData);
//Route for resetting password.
app.post("/forgotPassword", forgotPassword);
//Route to get admit card of a particluar semester.
app.post("/admitCard", getAdmitCard);
//Route to get grade card of a particular semester.
app.post("/gradeCard", getGradeCard);
//Route to get notices.
app.get("/notices", getNotices);