快速服务器在5 POST后无响应
问题描述:
我正在使用express来提供单页web应用程序,并作为所述应用程序的REST端点。一切工作正常静态页面服务,但5后,服务器变得无法响应。我看到很多其他帖子都有这个问题,但他们都说只要确保调用res.send()或res.end(),我就可以在任何地方调用,而不管逻辑如何分支。 app.js代码如下。快速服务器在5 POST后无响应
/**
* Module dependencies.
*/
var express = require('express'),
http = require('http'),
path = require('path');
var app = express();
var auth = require("./controllers/authentication.js");
http.globalAgent.maxSockets = 100;
app.configure(function(){
app.set('port', process.env.PORT || 3000);
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(app.router);
});
app.configure('development', function(){
app.use(express.errorHandler());
});
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
});
app.get('/public/*', function(req, res) {
res.sendfile('.'+req.url);
});
app.post('/auth/login', function(req, res, next) {
auth.login(req, res, next);
});
app.post('/auth/logout', function(req, res, next) {
auth.logout(req, res, next);
});
app.post('/auth/verify', function(req, res, next) {
auth.verify(req, res, next, function(req, res, next) {
res.conentType = 'json';
res.send(200, "authorized");
});
});
http.createServer(app).listen(app.get('port'), function(){
console.log("Express server listening on port " + app.get('port'));
});
,这里是命令行输出,我得到的(我试过后发出的其他请求,但服务器不会对其进行处理)。我认为我不知道怎样正确地终止连接,但不知道如何。
答
问题涉及未关闭MySQL连接池