const express = require('express')
+const utils = require('../../helpers/utils')
+
const router = express.Router()
const clientsController = require('./clients')
router.use('/users', usersController)
router.use('/videos', videosController)
router.use('/ping', pong)
-router.use('/*', badRequest)
+router.use('/*', utils.badRequest)
// ---------------------------------------------------------------------------
function pong (req, res, next) {
return res.send('pong').status(200).end()
}
-
-function badRequest (req, res, next) {
- res.type('json').status(400).end()
-}
--- /dev/null
+'use strict'
+
+const express = require('express')
+
+const utils = require('../../../helpers/utils')
+
+const router = express.Router()
+
+const videosRemoteController = require('./videos')
+
+router.use('/videos', videosRemoteController)
+router.use('/*', utils.badRequest)
+
+// ---------------------------------------------------------------------------
+
+module.exports = router
const express = require('express')
const waterfall = require('async/waterfall')
-const db = require('../../initializers/database')
-const middlewares = require('../../middlewares')
+const db = require('../../../initializers/database')
+const middlewares = require('../../../middlewares')
const secureMiddleware = middlewares.secure
const validators = middlewares.validators.remote
-const logger = require('../../helpers/logger')
+const logger = require('../../../helpers/logger')
const router = express.Router()
-router.post('/videos',
+router.post('/',
validators.signature,
secureMiddleware.checkSignature,
validators.remoteVideos,
const logger = require('./logger')
const utils = {
+ badRequest,
cleanForExit,
generateRandomString,
isTestInstance
}
+function badRequest (req, res, next) {
+ res.type('json').status(400).end()
+}
+
function generateRandomString (size, callback) {
crypto.pseudoRandomBytes(size, function (err, raw) {
if (err) return callback(err)