首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >express服务器在5次开机自检后无响应

express服务器在5次开机自检后无响应
EN

Stack Overflow用户
提问于 2015-05-29 20:55:45
回答 1查看 315关注 0票数 2

我使用express来提供单页webapp,并作为所述应用程序的REST端点。静态页面服务一切正常,但在5个帖子之后,服务器变得没有响应。我见过很多其他有这个问题的帖子,但他们都说只要确保调用res.send()或res.end(),不管逻辑是如何分支的,我每次都会在某个地方调用它们。app.js代码如下所示。

代码语言:javascript
复制
/**
 * 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'));
});

下面是我得到的命令行输出(之后我尝试发出其他请求,但服务器不会处理它们)。我假设我不知何故没有正确地终止连接,但无法弄清楚如何终止连接。

EN

回答 1

Stack Overflow用户

发布于 2015-05-29 22:53:25

问题与未关闭mysql连接池有关

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30530214

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档