diff options
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -17,10 +17,10 @@ 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') |
23 | db.init() | ||
24 | 24 | ||
25 | // ----------- Checker ----------- | 25 | // ----------- Checker ----------- |
26 | const checker = require('./server/initializers/checker') | 26 | const checker = require('./server/initializers/checker') |
@@ -39,9 +39,7 @@ if (errorMessage !== null) { | |||
39 | const customValidators = require('./server/helpers/custom-validators') | 39 | const customValidators = require('./server/helpers/custom-validators') |
40 | const installer = require('./server/initializers/installer') | 40 | const installer = require('./server/initializers/installer') |
41 | const migrator = require('./server/initializers/migrator') | 41 | const migrator = require('./server/initializers/migrator') |
42 | const mongoose = require('mongoose') | ||
43 | const routes = require('./server/controllers') | 42 | const routes = require('./server/controllers') |
44 | const Request = mongoose.model('Request') | ||
45 | 43 | ||
46 | // ----------- Command line ----------- | 44 | // ----------- Command line ----------- |
47 | 45 | ||
@@ -59,7 +57,8 @@ app.use(expressValidator({ | |||
59 | customValidators.misc, | 57 | customValidators.misc, |
60 | customValidators.pods, | 58 | customValidators.pods, |
61 | customValidators.users, | 59 | customValidators.users, |
62 | customValidators.videos | 60 | customValidators.videos, |
61 | customValidators.remote.videos | ||
63 | ) | 62 | ) |
64 | })) | 63 | })) |
65 | 64 | ||
@@ -130,7 +129,7 @@ installer.installApplication(function (err) { | |||
130 | // ----------- Make the server listening ----------- | 129 | // ----------- Make the server listening ----------- |
131 | server.listen(port, function () { | 130 | server.listen(port, function () { |
132 | // Activate the pool requests | 131 | // Activate the pool requests |
133 | Request.activate() | 132 | db.Request.activate() |
134 | 133 | ||
135 | logger.info('Server listening on port %d', port) | 134 | logger.info('Server listening on port %d', port) |
136 | logger.info('Webserver: %s', constants.CONFIG.WEBSERVER.URL) | 135 | logger.info('Webserver: %s', constants.CONFIG.WEBSERVER.URL) |