Commit ae643ea736326ac54a194e2408c7430f794cb9c4
1 parent
f9c9a148
Exists in
master
Adicionada flag para configurar o servidor no modo SSL.
Showing
2 changed files
with
20 additions
and
4 deletions
Show diff stats
helpers/properties.js
server.js
... | ... | @@ -77,7 +77,21 @@ app.delete('/api/:hash', function(req, res) { |
77 | 77 | }); |
78 | 78 | }); |
79 | 79 | |
80 | -var httpsServer = https.createServer(credentials, app); | |
81 | -httpsServer.listen(properties.PORT, properties.HOST, function() { | |
82 | - console.log('Server running on ' + properties.HOST + ':' + properties.PORT); | |
83 | -}); | |
80 | +function createHttpsServer() { | |
81 | + var httpsServer = https.createServer(credentials, app); | |
82 | + httpsServer.listen(properties.PORT, properties.HOST, function() { | |
83 | + console.log('Server running on https://' + properties.HOST + ':' + properties.PORT); | |
84 | + }); | |
85 | +} | |
86 | + | |
87 | +function createHttpServer() { | |
88 | + app.listen(properties.PORT, properties.HOST, function() { | |
89 | + console.log('Server running on http://' + properties.HOST + ':' + properties.PORT); | |
90 | + }); | |
91 | +} | |
92 | + | |
93 | +if (properties.SSL) { | |
94 | + createHttpsServer(); | |
95 | +} else { | |
96 | + createHttpServer(); | |
97 | +} | ... | ... |