survey.route.ts 674 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 } 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
router.route("/create").post(authCtrl.requireLogin, surveyCtrl.createSurvey);
Jiwon Yoon's avatar
Jiwon Yoon committed
8
router
Jiwon Yoon's avatar
Jiwon Yoon committed
9
10
11
  .route("/edit/:surveyId")
  .get(authCtrl.requireLogin, authCtrl.authenticate, surveyCtrl.getSurveyById)
  .put(authCtrl.requireLogin, authCtrl.authenticate, surveyCtrl.updateSurvey);
12
13
14
15
16
17
18
19
router
  .route("/delete/:surveyId")
  .delete(
    authCtrl.requireLogin,
    authCtrl.authenticate,
    surveyCtrl.deleteSurvey
  );

Jiwon Yoon's avatar
Jiwon Yoon committed
20
router.param("surveyId", surveyCtrl.userBySurveyId);
Jiwon Yoon's avatar
Jiwon Yoon committed
21
22

export default router;