I'm building a bookstore app am using an SQL database with the mysqljs module i can fetch all books from database but i want to access one book and display its details.
I fetch the book object by its id and i display it in the console
book details route:
/* GET Book Details page. */
router.get('/details/:id', function(req, res, next) {
var sql = `SELECT * FROM books WHERE id = ${req.params.id}`;
var query = db.query(sql, function (err, result) {
if(err) throw err;
console.log(result);
var model = {result: result}
res.render('shop/details', { title: 'Books', model });
});
});
displays this on the console
this is what the console displays
in my handlebars code i wrote
<h1 class="text-center">Book Details Here</h1>
<h3> Your Book Name is {{this.BookName}}</h3>
but it only displays "Your Book Name is " without the book name