Node.js-Expess-MongoDB-CRUD icon indicating copy to clipboard operation
Node.js-Expess-MongoDB-CRUD copied to clipboard

Updated

Open neeraj-2 opened this issue 4 years ago • 3 comments

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)

neeraj-2 avatar Aug 04 '20 06:08 neeraj-2

demo1 demo2 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

neeraj-2 avatar Aug 04 '20 06:08 neeraj-2

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

Savalone47 avatar Aug 12 '20 07:08 Savalone47

Thank you!!!!

AzamatZhubandykov avatar Nov 29 '20 18:11 AzamatZhubandykov