Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Express Basics Using Templates with Express Breaking Your Project’s Templates into Partials

"Cannot / GET" error with CSP code

When running local host I get a Cannot GET /index or /cards error. and the browser console gives the following error message:

Refused to load the image '<http://localhost:3000/favicon.ico>' because it violates the following Content Security Policy directive: "default-src 'none'". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.

And sometimes CSP Refused to load the font (Avenir light & medium) errors on the same default-src. I've read about CSP on MDN but can't really figure out what/why it is happening as my code is the same as the example code and how I can fix it.

1 Answer

After some trial and error I found the answer. The problem was an indent error in the footer and header.pug files I had :

    footer
        p The best study app ever created

And it should have been:

footer
    p The best study app ever created

Just leaving it here in case anyone else ever comes across the same problem.