我使用express来提供单页webapp,并作为所述应用程序的REST端点。静态页面服务一切正常,但在5个帖子之后,服务器变得没有响应。我见过很多其他有这个问题的帖子,但他们都说只要确保调用res.send()或res.end(),不管逻辑是如何分支的,我每次都会在某个地方调用它们。app.js代码如下所示。
/**
* 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'));
});下面是我得到的命令行输出(之后我尝试发出其他请求,但服务器不会处理它们)。我假设我不知何故没有正确地终止连接,但无法弄清楚如何终止连接。

发布于 2015-05-29 22:53:25
问题与未关闭mysql连接池有关
https://stackoverflow.com/questions/30530214
复制相似问题