Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Updated #2

wants to merge 1 commit into from

Conversation

neeraj-2
Copy link

@neeraj-2 neeraj-2 commented Aug 4, 2020

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)

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 neeraj-2 closed this Aug 4, 2020
@neeraj-2
Copy link
Author

neeraj-2 commented Aug 4, 2020

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 neeraj-2 reopened this Aug 4, 2020
@Savalone47
Copy link

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

@AzamatZhubandykov
Copy link

Thank you!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants