diff options
| author | HumairAK <humair88@hotmail.com> | 2016-07-24 20:45:03 +0000 |
|---|---|---|
| committer | HumairAK <humair88@hotmail.com> | 2016-07-24 20:45:03 +0000 |
| commit | d7b7979ee012dde10feae7d64e53fde2847aaf89 (patch) | |
| tree | ba2afca72170274c2ee6a24d0bf2fb7d1771bc25 /routes/index.js | |
| parent | bb66f6a9f7d6a2f9d75ab7d42483339618615e03 (diff) | |
added comments to frient-end
Diffstat (limited to 'routes/index.js')
| -rw-r--r-- | routes/index.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/routes/index.js b/routes/index.js index ae7b194..d8cfd36 100644 --- a/routes/index.js +++ b/routes/index.js @@ -2,6 +2,7 @@ var dbFile = require("../node_simple.js"); var express = require('express'); var router = express.Router(); var csrf = require('csurf'); // Cross-Site Request Forgery prevention + var csrfProtection = csrf(); router.use(csrfProtection); // router is protected @@ -114,7 +115,7 @@ router.get('/questions/:exam_id', function (req,res) { // Find q_id in questionsInfo, update comment/solutions count questionsInfo.forEach(function(q){ - if (q.id == question.id){ + if (question.q_id == q._id){ question.count += q.count; question.comments += q.comments; } @@ -187,7 +188,7 @@ router.get('/solutions/:exam_id/:q_num', function (req, res) { solutions.forEach(function(soln){ soln.commentCount = soln.comments.length; }); - res.render('user_solutions', {query: solutions, examID: examID, qID: qID}); + res.render('user_solutions', {query: solutions, examID: examID, qID: qID, csrfToken: req.csrfToken()}); }); }); |
