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 trialStephen Falck
7,558 Pointsusing a fetch request in my own project and receiving error message
im getting this:
Access to fetch at 'http://0.0.0.0:5000/api/v1/BlogPostView' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
followed by:
Uncaught (in promise) TypeError: Failed to fetch
how can i solve this problem?
1 Answer
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsHave you enabled CORS on the server side? What language/framework are you using? There are some guides here: https://enable-cors.org/server.html
Stephen Falck
7,558 PointsI havent so i guess that must be the problem. Im using the flask framework with python and i created the database using sqlite with peewee
Stephen Falck
7,558 PointsStephen Falck
7,558 Pointsgreat that has made it work, thanks!