survey.route.ts 850 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, surveyCtrl, questionCtrl } from "../controllers";
Jiwon Yoon's avatar
Jiwon Yoon committed
3
4
5

const router = express.Router();

6
router.route("/").get(authCtrl.requireLogin, surveyCtrl.getSurveys);
Jiwon Yoon's avatar
Jiwon Yoon committed
7

Jiwon Yoon's avatar
Jiwon Yoon committed
8
router.route("/create").post(authCtrl.requireLogin, surveyCtrl.createSurvey);
9

Lee SeoYeon's avatar
Lee SeoYeon committed
10
router.route("/:surveyId").get(surveyCtrl.getSurveyById);
Jiwon Yoon's avatar
Jiwon Yoon committed
11
router
jang dong hyeok's avatar
.    
jang dong hyeok committed
12
  .route("/:surveyId/edit")
Jiwon Yoon's avatar
Jiwon Yoon committed
13
14
  .get(authCtrl.requireLogin, authCtrl.authenticate, surveyCtrl.getSurveyById)
  .put(authCtrl.requireLogin, authCtrl.authenticate, surveyCtrl.updateSurvey);
15
router
jang dong hyeok's avatar
jang dong hyeok committed
16
  .route("/:surveyId/delete")
17
18
19
20
21
22
  .delete(
    authCtrl.requireLogin,
    authCtrl.authenticate,
    surveyCtrl.deleteSurvey
  );

Jiwon Yoon's avatar
Jiwon Yoon committed
23
24
25
26
router
  .route("/:surveyId/questions")
  .post(authCtrl.requireLogin, questionCtrl.createQuestion);

Jiwon Yoon's avatar
Jiwon Yoon committed
27
router.param("surveyId", surveyCtrl.userBySurveyId);
Jiwon Yoon's avatar
Jiwon Yoon committed
28
29

export default router;