import Student from '../models/Student.js'
 
export const createStudent = async(req,res) => {
    try{
        const student = await Student.create(req.body);
        res.status(201).json(student);
    }catch(error){
        
        res.status(500).json({message:error.message});
    }
};

export const getStudent = async (req,res) => {
    try{
        const student = await Student.find();
        res.status(200).json(student);
    }catch(error){
        res.status(500).json({message:error.message});
    }
};

export const updateStudent = async (req,res) => {
    try{
        const student = await Student.findByIdAndUpdate();
        res.status(200).json(student);
    }catch(error){
        res.status(500).json({message:error.message});
    }
};

export const deleteStudent = async (req,res) => {
    try{
        const student = await Student.findByIdAndDelete(req.params.id);
        res.status(200).json({message:"deleted succssfully"});
    }catch(error){
        res.status(500).json({message:error.message});
    }
};
 