aboutsummaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
authornanalelfe <nargiza.nosirova@mail.utoronto.ca>2016-07-20 21:11:59 +0000
committernanalelfe <nargiza.nosirova@mail.utoronto.ca>2016-07-20 21:11:59 +0000
commitd46b37fcb7c97ab59fd929cfc0a8d766ca8a0b8a (patch)
tree3b51e4c196bacd7c4524e8dbdb472a0e972aac8c /app.js
parent3d2f0e48def5b314121f7315ada1008f6801fa2b (diff)
parent7a9c0a4732ba720fba72be06dcafa0dbbf26022b (diff)
Merged
Diffstat (limited to 'app.js')
-rw-r--r--app.js48
1 files changed, 0 insertions, 48 deletions
diff --git a/app.js b/app.js
index ac78e16..72f238e 100644
--- a/app.js
+++ b/app.js
@@ -41,51 +41,3 @@ app.use(express.static(__dirname));
app.use('/', routes);
module.exports = app;
-
-app.listen(3000, function() {
- console.log('listening on http://localhost:3000/');
-});
-
-//to fetch exams given a course code and populate the exams page
-app.get('/exams',function (req,res) {
- console.log(req.query.search);
- var courseName = req.query.search;
- courseName = sanitizer.escape(courseName);
- courseName = courseName.toUpperCase();
- console.log(courseName);
- var result = getExamsForCourseCode(courseName);
- console.log(result);
- res.write(JSON.stringify(result));
-});
-
-function getExamsForCourseCode(courseCode) {
- var minExamInfoArray = [];
- dbFile.get_all_exams(courseCode, function (exams) {
- if (exams.length == 0){
- console.log("Nothing was found");
- }
- else {
- //console.log(exams);
- //only pass over the information that is necessary for the exams page
- for (var i = 0; i<exams.length;i++){
- var minExamInfo = { courseCode:exams[i].course_code,
- year:exams[i].year,
- term:toProperCase(exams[i].term),
- instructors:exams[i].instructors,
- type:toProperCase(exams[i].type) + " Examination"
- };
- minExamInfoArray.push(minExamInfo);
- console.log(minExamInfo);
- }
- }
- });
-
- return minExamInfoArray;
-}
-
-
-/*Helper function to make sure the proper capital case is presented*/
-
-function toProperCase(string) {
- return string.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
-}