Reputation: 1
Handlebars: Access has been denied to resolve the property "title" because it is not an "own property" of its parent. You can add a runtime option to disable the check or this warning: See http://localhost:8080/api-reference/runtime-options.html#options-to-control-prototype-access for details Handlebars: Access has been denied to resolve the property "description" because it is not an "own property" of its parent.
Upvotes: 0
Views: 1194
Reputation: 95
download the package npm install @handlebars/allow-prototype-access
and import this to your app.js
const {allowInsecurePrototypeAccess} = require('@handlebars/allow-prototype-access')
and to app.engine()in your app.js use this syntax:
app.engine('handlebars', exphbs({ defaultLayout: 'main', handlebars: allowInsecurePrototypeAccess(Handlebars) },
));
app.set('view engine', 'handlebars',);
Upvotes: 0
Reputation: 101
// Idea Index Page
app.get('/ideas', (req, res) => {
Test1.find({})
.sort({date:'desc'})
.lean()
.then(ideas => {
res.render('ideas/index', {
ideas1: ideas
});
});
});
use .lean()
and it works properly.
Upvotes: 2