Commit 6c6ed32d8aba4e50f421bb0a650b0a706da35aab

Authored by André Araújo
1 parent ae643ea7
Exists in master

Adiciona timeout

Showing 2 changed files with 9 additions and 4 deletions   Show diff stats
helpers/properties.js
1 1 var host = 'localhost';
2   -var port = 5001;
  2 +var port = 201;
3 3 var ssl = false;
  4 +var connectionTimeout = 30 * 60 * 1000;
4 5  
5 6 module.exports.HOST = host;
6 7 module.exports.PORT = port;
7 8 module.exports.SSL = ssl;
  9 +module.exports.CONNECTION_TIMEOUT = connectionTimeout;
... ...
server.js
... ... @@ -7,6 +7,7 @@ var endpoint_sinal = require('./endpoints/sinal');
7 7 /* Environment */
8 8 var fs = require('fs');
9 9 var https = require('https');
  10 +var http = require('http');
10 11 var path = require('path');
11 12 var express = require('express');
12 13 var bodyParser = require('body-parser');
... ... @@ -85,9 +86,11 @@ function createHttpsServer() {
85 86 }
86 87  
87 88 function createHttpServer() {
88   - app.listen(properties.PORT, properties.HOST, function() {
89   - console.log('Server running on http://' + properties.HOST + ':' + properties.PORT);
90   - });
  89 + var httpServer = http.createServer(app);
  90 + httpServer.setTimeout(properties.CONNECTION_TIMEOUT);
  91 + httpServer.listen(properties.PORT, properties.HOST, function() {
  92 + console.log('Server running on http://' + properties.HOST + ':' + properties.PORT);
  93 + });
91 94 }
92 95  
93 96 if (properties.SSL) {
... ...