aboutsummaryrefslogtreecommitdiff
path: root/routes
diff options
context:
space:
mode:
Diffstat (limited to 'routes')
-rw-r--r--routes/index.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/routes/index.js b/routes/index.js
index 84087e7..16f5778 100644
--- a/routes/index.js
+++ b/routes/index.js
@@ -83,6 +83,27 @@ router.get('/search', function(req, res, next) {
res.redirect('/exams/' + courseName);
});
+
+/* REDIRECT - exam -> questions page*/
+router.get('/exam_click',function (req,res) {
+ //TODO:get needs to have exam_id attached
+ var examId = req.query.exam_id;
+ res.redirect('/questions/'+examId);
+});
+
+/*EXAMPLE DATA GIVEN BELOW:
+ * questions = [{id,count,comments},{id,count,comments}] --> array of "question" objects
+ *
+ * id = questions number
+ * count= number of solutions
+ * comments = number of comments*/
+router.get('/questions/:exam_id', function (req,res) {
+ dbFile.get_exam_info_by_ID(req.params.exam_id, function (questions) {
+
+ res.render('questions', {query: questions});
+ });
+});
+
router.get('/signup', function(req, res, next) {
res.render('signup', {csrfToken: req.csrfToken()});
});