Saturday 10 June 2017

Update function mongoose

router.put('/:student_id', function (req, res, next) {

Student.findOneAndUpdate(req.params.student_id, req.body, function (error) {

    if (error) res.status(500).json({
        success: false,
        error: error
    });
    res.status(200).json({
        success: true,
        data: student
    });
});

});



via Bilel Harabi

No comments:

Post a Comment