Nothing here yet.
Nothing here yet.
No blogs yet.
The route snippet is const express = require ( 'express' ); const app = express(); const editBookRouter = express.Router(); const Book= require ( '../models/book' ) editBookRouter.route( '/edit/:id' ).get( function ( req, res ) { const book = new Book(req.body); const id = req.param.id; Book.findById(id) .then(Book => { console .log(book) // prints the id res.json(book); }) Book.findById(id, function ( err, book ) { if (err){ console .log(err); } else { res.json(book); console .log( book); // prints null } }); }); module .exports = editBookRouter; After making the changes Now I'm able to get the object id but how to send the data from node to react.