Moved requirements to the top of module

This commit is contained in:
Daniel García Aubert 2015-12-03 18:35:49 +01:00
parent c6bae6d951
commit 96e9fcbe33

View File

@ -21,6 +21,12 @@ var StatsD = require('node-statsd').StatsD;
var _ = require('underscore'); var _ = require('underscore');
var LRU = require('lru-cache'); var LRU = require('lru-cache');
var GenericController = require('./controllers/generic_controller');
var QueryController = require('./controllers/query_controller');
var CacheStatusController = require('./controllers/cache_status_controller');
var HealthCheckController = require('./controllers/health_check_controller');
var VersionController = require('./controllers/version_controller');
process.env.PGAPPNAME = process.env.PGAPPNAME || 'cartodb_sqlapi'; process.env.PGAPPNAME = process.env.PGAPPNAME || 'cartodb_sqlapi';
// override Date.toJSON // override Date.toJSON
@ -153,23 +159,18 @@ function App() {
// basic routing // basic routing
var GenericController = require('./controllers/generic_controller');
var genericController = new GenericController(); var genericController = new GenericController();
genericController.register(app); genericController.register(app);
var QueryController = require('./controllers/query_controller');
var queryController = new QueryController(metadataBackend, tableCache, statsd_client); var queryController = new QueryController(metadataBackend, tableCache, statsd_client);
queryController.register(app); queryController.register(app);
var CacheStatusController = require('./controllers/cache_status_controller');
var cacheStatusController = new CacheStatusController(tableCache); var cacheStatusController = new CacheStatusController(tableCache);
cacheStatusController.register(app); cacheStatusController.register(app);
var HealthCheckController = require('./controllers/health_check_controller');
var healthCheckController = new HealthCheckController(); var healthCheckController = new HealthCheckController();
healthCheckController.register(app); healthCheckController.register(app);
var VersionController = require('./controllers/version_controller');
var versionController = new VersionController(); var versionController = new VersionController();
versionController.register(app); versionController.register(app);