-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
165 lines (144 loc) · 4.6 KB
/
app.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
const express = require("express");
const bodyParser = require("body-parser");
const ejs = require("ejs");
const _ = require("lodash");
const { reverse } = require("lodash");
const app = express();
app.set("view engine", "ejs");
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.static("public"));
app.get("/", (req, res) => {
res.sendFile(__dirname + "/index.html");
});
app.post("/", (req, res) => {
const sessionYear = req.body.sessionyear;
const rollNo = req.body.rollno;
const studentName = _.toUpper(req.body.studentname);
const fatherName = _.toUpper(req.body.fathername);
const motherName = _.toUpper(req.body.mothername);
const schoolName = _.toUpper(req.body.schoolname);
const Day = req.body.day;
const Month = req.body.month;
const Year = req.body.year;
const studentClass = req.body.studentclass;
const StudentDob = Day + "/" + Month + "/" + Year;
// 1st subject
const sub1Code = req.body.sub1code;
const sub1Name = _.toUpper(req.body.sub1name);
const sub1ThMarks = Number(req.body.sub1thmarks);
const sub1PrMarks = Number(req.body.sub1prmarks);
const sub1TotalMarks = sub1ThMarks + sub1PrMarks;
// 2nd subject
const sub2Code = req.body.sub2code;
const sub2Name = _.toUpper(req.body.sub2name);
const sub2ThMarks = Number(req.body.sub2thmarks);
const sub2PrMarks = Number(req.body.sub2prmarks);
const sub2TotalMarks = sub2ThMarks + sub2PrMarks;
// 3nd subject
const sub3Code = req.body.sub3code;
const sub3Name = _.toUpper(req.body.sub3name);
const sub3ThMarks = Number(req.body.sub3thmarks);
const sub3PrMarks = Number(req.body.sub3prmarks);
const sub3TotalMarks = sub3ThMarks + sub3PrMarks;
// 4th subject
const sub4Code = req.body.sub4code;
const sub4Name = _.toUpper(req.body.sub4name);
const sub4ThMarks = Number(req.body.sub4thmarks);
const sub4PrMarks = Number(req.body.sub4prmarks);
const sub4TotalMarks = sub4ThMarks + sub4PrMarks;
// 5th subjec5
const sub5Code = req.body.sub5code;
const sub5Name = _.toUpper(req.body.sub5name);
const sub5ThMarks = Number(req.body.sub5thmarks);
const sub5PrMarks = Number(req.body.sub5prmarks);
const sub5TotalMarks = sub5ThMarks + sub5PrMarks;
if (studentClass === "Class X") {
res.render("class10th", {
SESSIONYEAR: sessionYear,
ROLLNO: rollNo,
STUDENTNAME: studentName,
FATHERNAME: fatherName,
MOTHERNAME: motherName,
STUDENTDOB: StudentDob,
SCHOOLNAME: schoolName,
CLASS: studentClass,
// 1st subject
SUB1CODE: sub1Code,
SUB1NAME: sub1Name,
SUB1THMARKS: sub1ThMarks,
SUB1PRMARKS: sub1PrMarks,
SUB1TOTALMARKS: sub1TotalMarks,
// 2nd subject
SUB2CODE: sub2Code,
SUB2NAME: sub2Name,
SUB2THMARKS: sub2ThMarks,
SUB2PRMARKS: sub2PrMarks,
SUB2TOTALMARKS: sub2TotalMarks,
// 3rd subject
SUB3CODE: sub3Code,
SUB3NAME: sub3Name,
SUB3THMARKS: sub3ThMarks,
SUB3PRMARKS: sub3PrMarks,
SUB3TOTALMARKS: sub3TotalMarks,
// 4t subject
SUB4CODE: sub4Code,
SUB4NAME: sub4Name,
SUB4THMARKS: sub4ThMarks,
SUB4PRMARKS: sub4PrMarks,
SUB4TOTALMARKS: sub4TotalMarks,
// 5th subject
SUB5CODE: sub5Code,
SUB5NAME: sub5Name,
SUB5THMARKS: sub5ThMarks,
SUB5PRMARKS: sub5PrMarks,
SUB5TOTALMARKS: sub5TotalMarks,
});
} else {
res.render("index", {
SESSIONYEAR: sessionYear,
ROLLNO: rollNo,
STUDENTNAME: studentName,
FATHERNAME: fatherName,
MOTHERNAME: motherName,
SCHOOLNAME: schoolName,
CLASS: studentClass,
// 1st subject
SUB1CODE: sub1Code,
SUB1NAME: sub1Name,
SUB1THMARKS: sub1ThMarks,
SUB1PRMARKS: sub1PrMarks,
SUB1TOTALMARKS: sub1TotalMarks,
// 2nd subject
SUB2CODE: sub2Code,
SUB2NAME: sub2Name,
SUB2THMARKS: sub2ThMarks,
SUB2PRMARKS: sub2PrMarks,
SUB2TOTALMARKS: sub2TotalMarks,
// 3rd subject
SUB3CODE: sub3Code,
SUB3NAME: sub3Name,
SUB3THMARKS: sub3ThMarks,
SUB3PRMARKS: sub3PrMarks,
SUB3TOTALMARKS: sub3TotalMarks,
// 4t subject
SUB4CODE: sub4Code,
SUB4NAME: sub4Name,
SUB4THMARKS: sub4ThMarks,
SUB4PRMARKS: sub4PrMarks,
SUB4TOTALMARKS: sub4TotalMarks,
// 5th subject
SUB5CODE: sub5Code,
SUB5NAME: sub5Name,
SUB5THMARKS: sub5ThMarks,
SUB5PRMARKS: sub5PrMarks,
SUB5TOTALMARKS: sub5TotalMarks,
});
}
});
let port = process.env.PORT;
if (port == null || port == "") {
port = 3000;
}
app.listen(port, () =>
console.log(`Server has started on port ${port} successfully !`)
);