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

Error view docs from router /docs #418

Open
dgamepuzzle opened this issue Apr 8, 2021 · 1 comment
Open

Error view docs from router /docs #418

dgamepuzzle opened this issue Apr 8, 2021 · 1 comment

Comments

@dgamepuzzle
Copy link

dgamepuzzle commented Apr 8, 2021

Uncaught (in promise) EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".

I recived this error when view docs from node app (example : http://localhost:3000/v1/docs)
Please help!

@nuttyroll
Copy link

/**

  • GET v1/docs
    */
    router.use('/docs', express.static('docs', {
    setHeaders(req, res) {
    console.log(res);
    req.set('Content-Security-Policy', "script-src 'self' 'unsafe-eval'");
    },
    }));

Add this in routes/index.js

Handlebar uses eval which is causing the error.

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

No branches or pull requests

2 participants