const express = require("express")
const router = express.Router()
const { protect } = require('../middleware/auth');
const { adminOnly } = require('../middleware/admin');
const{addbook,getbook,getbookbyid,deletebook,updatebook} = require('../controllers/bookController')

router.use(protect)

router.post('/addbook', adminOnly, addbook)
router.get('/getbook', getbook)
router.get('/getbookbyid/:id', getbookbyid)
router.delete('/deletebook/:id', adminOnly, deletebook)
router.put('/updatebook/:id', adminOnly, updatebook)


module.exports = router
