import { Router } from 'express';
import auth from '../middleware/auth.js';
import upload from '../middleware/upload.js';
import { getAll, getOne, create, update, remove } from '../controllers/newsController.js';

const router = Router();

router.get('/', getAll);
router.get('/:slug', getOne);
router.post('/', auth, upload.single('image'), create);
router.put('/:id', auth, upload.single('image'), update);
router.delete('/:id', auth, remove);

export default router;