const express = require('express')

const router = express.Router()

const {protect} =require('../middleware/auth')
const {adminOnly} = require('../middleware/admin')
const {addstudent,getstudentbyid,getstudent,updatestudent,deletestudent} = require('../controllers/studentController')

router.use(protect)

router.post('/addstudent', adminOnly, addstudent)
router.get('/getstudent', getstudent)
router.get('/getstudentbyid/:id', getstudentbyid)
router.put('/updatestudent/:id', adminOnly, updatestudent)
router.delete('/deletestudent/:id', adminOnly, deletestudent)

module.exports =router
