question.route.ts 578 Bytes
Newer Older
Jiwon Yoon's avatar
Jiwon Yoon committed
1
import express from "express";
Jiwon Yoon's avatar
Jiwon Yoon committed
2
import { authCtrl, questionCtrl } from "../controllers";
Jiwon Yoon's avatar
Jiwon Yoon committed
3
4
5

const router = express.Router();

Jiwon Yoon's avatar
Jiwon Yoon committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
router
  .route("/create")
  .post(authCtrl.requireLogin, questionCtrl.createQuestion);
router
  .route("/update/:questionId")
  .put(
    authCtrl.requireLogin,
    authCtrl.authenticate,
    questionCtrl.updateQuestion
  );
router
  .route("/delete/:questionId")
  .delete(
    authCtrl.requireLogin,
    authCtrl.authenticate,
    questionCtrl.deleteQuestionById
  );

router.param("questionId", questionCtrl.userByQuestionId);
Jiwon Yoon's avatar
Jiwon Yoon committed
25
26

export default router;