Commit 6c6ed32d8aba4e50f421bb0a650b0a706da35aab
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 | var host = 'localhost'; | 1 | var host = 'localhost'; |
2 | -var port = 5001; | 2 | +var port = 201; |
3 | var ssl = false; | 3 | var ssl = false; |
4 | +var connectionTimeout = 30 * 60 * 1000; | ||
4 | 5 | ||
5 | module.exports.HOST = host; | 6 | module.exports.HOST = host; |
6 | module.exports.PORT = port; | 7 | module.exports.PORT = port; |
7 | module.exports.SSL = ssl; | 8 | module.exports.SSL = ssl; |
9 | +module.exports.CONNECTION_TIMEOUT = connectionTimeout; |
server.js
@@ -7,6 +7,7 @@ var endpoint_sinal = require('./endpoints/sinal'); | @@ -7,6 +7,7 @@ var endpoint_sinal = require('./endpoints/sinal'); | ||
7 | /* Environment */ | 7 | /* Environment */ |
8 | var fs = require('fs'); | 8 | var fs = require('fs'); |
9 | var https = require('https'); | 9 | var https = require('https'); |
10 | +var http = require('http'); | ||
10 | var path = require('path'); | 11 | var path = require('path'); |
11 | var express = require('express'); | 12 | var express = require('express'); |
12 | var bodyParser = require('body-parser'); | 13 | var bodyParser = require('body-parser'); |
@@ -85,9 +86,11 @@ function createHttpsServer() { | @@ -85,9 +86,11 @@ function createHttpsServer() { | ||
85 | } | 86 | } |
86 | 87 | ||
87 | function createHttpServer() { | 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 | if (properties.SSL) { | 96 | if (properties.SSL) { |