I use express as my web server for node, and everything seems to be working correctly. The only problem I encounter is when I load a specific page (route "/ learn") 10 times. As soon as I do this, the expression seems to stop working, although no error is logged on the console and nothing is displayed on the page. It just waits for the host in the browser. The strange thing is that the problem does not occur if I go from the page with the problem to another page, and then back. I can repeat it the way I want, without errors. Here is my route with the problem:
var bcrypt = require('bcrypt'); var pool = require('../database.js').pool; module.exports = function(app) { app.get('/learn', function(req, res, next) { var query = 'SELECT * FROM questions INNER JOIN answers ON questions.questionID = answers.questionID'; pool.getConnection(function(err, connection) { connection.query(query, function(err, rows) { if (err) { throw err; } var data = { name: req.session.name, problems: rows, }; res.render('learn.html', data); }); }); }); app.post('/learn/checkAnswer', function(req, res) {
I'm not sure if that matters, but I use handlebars as my rendering engine instead of jade, as well as node-mysql for my database.
source share