post.route.ts 597 Bytes
Newer Older
Lee Soobeom's avatar
Lee Soobeom committed
1
import express from "express";
Lee Soobeom's avatar
Lee Soobeom committed
2
import { postCtrl, authCtrl } from "../controllers";
Lee Soobeom's avatar
Lee Soobeom committed
3
4
5

const router = express.Router();

Lee Soobeom's avatar
Lee Soobeom committed
6
router.route("/").post(authCtrl.requireLogin, postCtrl.createFileAndPost);
Lee Soobeom's avatar
Lee Soobeom committed
7
router.route("/").get(postCtrl.getAllPost);
Lee Soobeom's avatar
Lee Soobeom committed
8

Lee Soobeom's avatar
Lee Soobeom committed
9
10
router.route("/files/:postId").get(authCtrl.requireLogin, postCtrl.getFiles);

Lee Soobeom's avatar
Lee Soobeom committed
11
12
13
router
  .route("/:postId")
  .post(authCtrl.requireLogin, postCtrl.addCounts)
Lee Soobeom's avatar
Lee Soobeom committed
14
  .delete(authCtrl.requireLogin, postCtrl.deleteOnePost) // +authenticate
Lee Soobeom's avatar
Lee Soobeom committed
15
  .put(authCtrl.requireLogin, postCtrl.updateOnePost);
Lee Soobeom's avatar
Lee Soobeom committed
16
17

router.param("postId", postCtrl.userByPostId);
Lee Soobeom's avatar
Lee Soobeom committed
18
export default router;