postsRoutes.js 416 B

1234567891011121314151617
  1. import express from "express";
  2. import { getPosts, createPost, updatePost, deletePost, likePost } from "../controllers/posts.js";
  3. import auth from '../middleware/auth.js '
  4. const router = express.Router()
  5. router.get('/', getPosts)
  6. router.post('/', auth, createPost)
  7. router.patch('/:id',auth, updatePost)
  8. router.delete('/:id',auth, deletePost)
  9. router.patch('/:id/likePost',auth, likePost)
  10. export default router