diff options
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -17,10 +17,9 @@ const app = express() | |||
17 | 17 | ||
18 | // ----------- Database ----------- | 18 | // ----------- Database ----------- |
19 | const constants = require('./server/initializers/constants') | 19 | const constants = require('./server/initializers/constants') |
20 | const database = require('./server/initializers/database') | ||
21 | const logger = require('./server/helpers/logger') | 20 | const logger = require('./server/helpers/logger') |
22 | 21 | // Initialize database and models | |
23 | database.connect() | 22 | const db = require('./server/initializers/database') |
24 | 23 | ||
25 | // ----------- Checker ----------- | 24 | // ----------- Checker ----------- |
26 | const checker = require('./server/initializers/checker') | 25 | const checker = require('./server/initializers/checker') |
@@ -39,9 +38,7 @@ if (errorMessage !== null) { | |||
39 | const customValidators = require('./server/helpers/custom-validators') | 38 | const customValidators = require('./server/helpers/custom-validators') |
40 | const installer = require('./server/initializers/installer') | 39 | const installer = require('./server/initializers/installer') |
41 | const migrator = require('./server/initializers/migrator') | 40 | const migrator = require('./server/initializers/migrator') |
42 | const mongoose = require('mongoose') | ||
43 | const routes = require('./server/controllers') | 41 | const routes = require('./server/controllers') |
44 | const Request = mongoose.model('Request') | ||
45 | 42 | ||
46 | // ----------- Command line ----------- | 43 | // ----------- Command line ----------- |
47 | 44 | ||
@@ -130,7 +127,7 @@ installer.installApplication(function (err) { | |||
130 | // ----------- Make the server listening ----------- | 127 | // ----------- Make the server listening ----------- |
131 | server.listen(port, function () { | 128 | server.listen(port, function () { |
132 | // Activate the pool requests | 129 | // Activate the pool requests |
133 | Request.activate() | 130 | db.Request.activate() |
134 | 131 | ||
135 | logger.info('Server listening on port %d', port) | 132 | logger.info('Server listening on port %d', port) |
136 | logger.info('Webserver: %s', constants.CONFIG.WEBSERVER.URL) | 133 | logger.info('Webserver: %s', constants.CONFIG.WEBSERVER.URL) |