]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server.js
Client: reset pagination when we search something
[github/Chocobozzz/PeerTube.git] / server.js
index 33e34019d96333f80f9b57fa60db0d9947f099b8..d38c5830f3f0ac565fbfdbe4b5554c98dc7c2bad 100644 (file)
--- a/server.js
+++ b/server.js
@@ -13,14 +13,6 @@ const WebSocketServer = require('ws').Server
 // Create our main app
 const app = express()
 
-// ----------- Checker -----------
-const checker = require('./server/initializers/checker')
-
-const miss = checker.checkConfig()
-if (miss.length !== 0) {
-  throw new Error('Miss some configurations keys : ' + miss)
-}
-
 // ----------- Database -----------
 const config = require('config')
 const constants = require('./server/initializers/constants')
@@ -29,14 +21,23 @@ const logger = require('./server/helpers/logger')
 
 database.connect()
 
+// ----------- Checker -----------
+const checker = require('./server/initializers/checker')
+
+const miss = checker.checkConfig()
+if (miss.length !== 0) {
+  throw new Error('Miss some configurations keys : ' + miss)
+}
+
 // ----------- PeerTube modules -----------
-const customValidators = require('./server/helpers/customValidators')
+const customValidators = require('./server/helpers/custom-validators')
 const installer = require('./server/initializers/installer')
 const mongoose = require('mongoose')
 const routes = require('./server/controllers')
 const utils = require('./server/helpers/utils')
 const webtorrent = require('./server/lib/webtorrent')
 const Request = mongoose.model('Request')
+const Video = mongoose.model('Video')
 
 // Get configurations
 const port = config.get('listen.port')
@@ -52,7 +53,7 @@ app.use(bodyParser.json())
 app.use(bodyParser.urlencoded({ extended: false }))
 // Validate some params for the API
 app.use(expressValidator({
-  customValidators: customValidators
+  customValidators: Object.assign({}, customValidators.misc, customValidators.users, customValidators.videos)
 }))
 
 // ----------- Views, routes and static files -----------
@@ -139,11 +140,13 @@ installer.installApplication(function (err) {
       // Activate the pool requests
       Request.activate()
 
-      // videos.seedAllExisting(function () {
+      Video.seedAllExisting(function (err) {
+        if (err) throw err
+
         logger.info('Seeded all the videos')
         logger.info('Server listening on port %d', port)
         app.emit('ready')
-      // })
+      })
     })
   })
 })