controllers/routes/book.js
/*
 * PUT /book/:id to updatea a book given its id
 */
PUT /book/:id to updatea a book given its id
PUT / book / : id to updatea a book given its id
function updateBook(req, res) {
    Book.findById({_id: req.params.id}, (err, book) => {
        if(err) res.send(err);
        Object.assign(book, req.body).save((err, book) => {
            if(err) res.send(err);
            res.json({ message: 'Book updated!', book });
        });
    });
}
function updateBook ( req , res ) { Book . findById ( { _id : req . params . id } , ( err , book ) => { if ( err ) res . send ( err ) ; Object . assign ( book , req . body ) . save ( ( err , book ) => { if ( err ) res . send ( err ) ; res . json ( { message : 'Book updated!' , book } ) ; } ) ; } ) ; }
PUT /book/:id to updatea a book given its id
PUT / book / : id to updatea a book given its id