controllers/routes/book.js
/*
 * POST /book to save a new book.
 */
POST /book to save a new book.
POST / book to save a new book .
function postBook(req, res) {
    var newBook = new Book(req.body);
    newBook.save((err,book) => {
        if(err) {
            res.send(err);
        }
        else { 
            res.json({message: "Book successfully added!", book });
        }
    });
}
function postBook ( req , res ) { var newBook = new Book ( req . body ) ; newBook . save ( ( err , book ) => { if ( err ) { res . send ( err ) ; } else { res . json ( { message : "Book successfully added!" , book } ) ; } } ) ; }
POST /book to save a new book.
POST / book to save a new book .
//Creates a new book //Save it into the DB. //If no errors, send it back to the client