From b60035d8e86b712e586550f762c26caae353dc0e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sat, 7 Nov 2015 18:40:13 +0100 Subject: Middleware refractoring --- routes/api/v1/videos.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'routes/api/v1/videos.js') diff --git a/routes/api/v1/videos.js b/routes/api/v1/videos.js index 06b248244..33c565437 100644 --- a/routes/api/v1/videos.js +++ b/routes/api/v1/videos.js @@ -4,7 +4,8 @@ var express = require('express') var router = express.Router() var middleware = require('../../../middlewares') - var reqValidator = require('../../../middlewares/reqValidators').videos + var miscMiddleware = middleware.misc + var reqValidator = middleware.reqValidators.videos var videos = require('../../../src/videos') function listVideos (req, res, next) { @@ -52,11 +53,11 @@ }) } - router.get('/', middleware.cache(false), listVideos) - router.post('/', reqValidator.videosAdd, middleware.cache(false), addVideos) - router.get('/search/:name', reqValidator.videosSearch, middleware.cache(false), searchVideos) - router.get('/:id', reqValidator.videosGet, middleware.cache(false), getVideos) - router.delete('/:id', reqValidator.videosRemove, middleware.cache(false), removeVideo) + router.get('/', miscMiddleware.cache(false), listVideos) + router.post('/', reqValidator.videosAdd, miscMiddleware.cache(false), addVideos) + router.get('/search/:name', reqValidator.videosSearch, miscMiddleware.cache(false), searchVideos) + router.get('/:id', reqValidator.videosGet, miscMiddleware.cache(false), getVideos) + router.delete('/:id', reqValidator.videosRemove, miscMiddleware.cache(false), removeVideo) module.exports = router })() -- cgit v1.2.3