aboutsummaryrefslogtreecommitdiffhomepage
path: root/server.js
diff options
context:
space:
mode:
Diffstat (limited to 'server.js')
-rw-r--r--server.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/server.js b/server.js
index 6eb022000..7503072af 100644
--- a/server.js
+++ b/server.js
@@ -17,10 +17,10 @@ const app = express()
17 17
18// ----------- Database ----------- 18// ----------- Database -----------
19const constants = require('./server/initializers/constants') 19const constants = require('./server/initializers/constants')
20const database = require('./server/initializers/database')
21const logger = require('./server/helpers/logger') 20const logger = require('./server/helpers/logger')
22 21// Initialize database and models
23database.connect() 22const db = require('./server/initializers/database')
23db.init()
24 24
25// ----------- Checker ----------- 25// ----------- Checker -----------
26const checker = require('./server/initializers/checker') 26const checker = require('./server/initializers/checker')
@@ -39,9 +39,7 @@ if (errorMessage !== null) {
39const customValidators = require('./server/helpers/custom-validators') 39const customValidators = require('./server/helpers/custom-validators')
40const installer = require('./server/initializers/installer') 40const installer = require('./server/initializers/installer')
41const migrator = require('./server/initializers/migrator') 41const migrator = require('./server/initializers/migrator')
42const mongoose = require('mongoose')
43const routes = require('./server/controllers') 42const routes = require('./server/controllers')
44const 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)