// @ts-check
const express = require('express');
const router = express.Router();
const { ah } = require('../middleware/asyncHandler');
const { listPosts, createPost, updatePost, deletePost } = require('../controllers/posts.controller');

router.get('/', ah(listPosts));
router.post('/', ah(createPost));
router.put('/:id', ah(updatePost));
router.delete('/:id', ah(deletePost));

module.exports = router;