post.route.ts 578 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, fileInfoCtrl } 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.createImgAndPost);
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
11
router
  .route("/:postId")
  .post(authCtrl.requireLogin, postCtrl.addCounts)
Lee Soobeom's avatar
Lee Soobeom committed
12
13
14
  .get(authCtrl.requireLogin, postCtrl.getOnePost)
  .delete(authCtrl.requireLogin, postCtrl.deleteOnePost) // authenticate
  .put(authCtrl.requireLogin, postCtrl.updatePost);
Lee Soobeom's avatar
Lee Soobeom committed
15
16

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