Node.js-Expess-MongoDB-CRUD
Node.js-Expess-MongoDB-CRUD copied to clipboard
Updated
There was a problem that i faced .I was not able to see data(full name,email,mobile,city)in" view all" field .But still data was present in my database in mongoDB compass. I found that i should install package by command "npm install @handlebars/allow-prototype-access" and should add above modification i.e 1.const Handlebars = require('handlebars') 2.const {allowInsecurePrototypeAccess} = require('@handlebars/allow-prototype-access') and instead 3.app.engine('hbs', exphbs({ extname: 'hbs', defaultLayout: 'mainLayout', layoutsDir: __dirname + '/views/layouts/' })); use: 4.app.engine('hbs', exphbs({ extname: 'hbs', handlebars: allowInsecurePrototypeAccess(Handlebars), defaultLayout: 'mainlayout', layoutsDir: __dirname + '/views/layouts/' })); will solve the problem and data can be seen in require field on browser(local host whatever u are using)
demo1 is the pic before changes ,and demo2 is the file after changes .I know in tutorial on u-tube it is working fine with the code u mentioned ,but in my system i faced this problem .So i tried and got this solution
well done i mean will solve the problem and the data can be seen in the "require" field of the browser (local host, whatever host is used) even another template engine like ejs can do it too
Thank you!!!!