Move requires to the top

This commit is contained in:
Maciej Małecki 2014-03-15 02:54:43 +01:00
parent 404cf13b48
commit 8c19d2ad50

View file

@ -17,6 +17,8 @@
'use strict'; 'use strict';
var http = require('http');
var https = require('https');
var path = require('path'); var path = require('path');
var express = require('express'); var express = require('express');
var argv = require('optimist').argv; var argv = require('optimist').argv;
@ -52,7 +54,6 @@ config.load(function(err, conf) {
atm.init(app, conf.config); atm.init(app, conf.config);
if (argv.https) { if (argv.https) {
var https = require('https');
var testkeys = path.join(__dirname, '..', 'testkeys'); var testkeys = path.join(__dirname, '..', 'testkeys');
var privateKey = fs.readFileSync(path.join(testkeys, 'privatekey.pem')); var privateKey = fs.readFileSync(path.join(testkeys, 'privatekey.pem'));
var certificate = fs.readFileSync(path.join(testkeys, 'certificate.pem')); var certificate = fs.readFileSync(path.join(testkeys, 'certificate.pem'));
@ -62,7 +63,6 @@ config.load(function(err, conf) {
}); });
} }
else { else {
var http = require('http');
http.createServer(app).listen(port, function () { http.createServer(app).listen(port, function () {
console.log('Express server listening on port ' + port + ' (http)'); console.log('Express server listening on port ' + port + ' (http)');
}); });