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

23 lines
745 B
TypeScript
Raw Normal View History

/* eslint-disable @typescript-eslint/no-misused-promises */
import { Router } from 'express'
// Controllers
import postCreateController from './posts/post-create'
import postDeleteController from './posts/post-delete'
import postInfoController from './posts/post-info'
import postUpdateController from './posts/post-update'
// Middlewares
import ensureAuthenticated from '../middlewares/ensure-authenticated'
const postsRouter = Router()
// Posts related
postsRouter.post('/create', ensureAuthenticated, postCreateController)
postsRouter.post('/delete', ensureAuthenticated, postDeleteController)
postsRouter.get('/info', postInfoController)
postsRouter.put('/update', ensureAuthenticated, postUpdateController)
export default postsRouter