project-knedita/src/controllers/posts-router.ts

24 lines
545 B
TypeScript
Raw Normal View History

/* eslint-disable @typescript-eslint/no-misused-promises */
import { Router } from 'express'
// Controllers
2023-07-28 13:41:28 +00:00
import post from './posts'
// Middlewares
2023-07-28 13:41:28 +00:00
import authenticated from '../middlewares/authenticated'
const postsRouter = Router()
2023-07-28 13:41:28 +00:00
// GET
postsRouter.get('/fetch-likes', post.fetchLikes)
postsRouter.get('/info', post.fetch)
// POST
postsRouter.post('/create', authenticated, post.create)
postsRouter.post('/delete', authenticated, post.delete)
// PUT
postsRouter.put('/update', authenticated, post.update)
export default postsRouter