videoRouter.js
863 Bytes
import express from "express";
import routes from "../routes";
import {
getUpload,
postUpload,
videoDetail,
deleteVideo,
getEditVideo,
postEditVideo,
} from "../controllers/videoController";
import { uploadVideo, onlyPrivate } from "../middlewares";
// export const videoRouter = express.Router(); 이렇게하면 이 변수만 export하게 된다.
const videoRouter = express.Router();
// Upload
videoRouter.get(routes.upload, onlyPrivate, getUpload);
videoRouter.post(routes.upload, onlyPrivate, uploadVideo, postUpload);
// Video Detail
videoRouter.get(routes.videoDetail(), videoDetail);
// Video Edit
videoRouter.get(routes.editVideo(), onlyPrivate, getEditVideo);
videoRouter.post(routes.editVideo(), onlyPrivate, postEditVideo);
// Video Delete
videoRouter.get(routes.deleteVideo(), onlyPrivate, deleteVideo);
export default videoRouter;