You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to use the code below to fetch data from Reddit...
import { Reddit } from 'graphqlhub-schemas';
import { GraphQLSchema, graphql } from 'graphql';
let schema = new GraphQLSchema({
query: Reddit.QueryObjectType
});
let query = '{ subreddit(name: "netflix"){newListings(limit: 10) { title score url } } }';
graphql(schema, query).then((result) => {
console.log(result);
});
I get a CORS error: Access to fetch at 'https://reddit.com/r/netflix/about.json' from origin 'http://localhost:3000' 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.
By right https://reddit.com will redirect to the one with www but because of the missing Access-Control-Allow-Origin response header, it doesn't.
Any work around for this?
The text was updated successfully, but these errors were encountered:
When I try to use the code below to fetch data from Reddit...
I get a CORS error:
Access to fetch at 'https://reddit.com/r/netflix/about.json' from origin 'http://localhost:3000' 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.
By right
https://reddit.com
will redirect to the one withwww
but because of the missingAccess-Control-Allow-Origin
response header, it doesn't.Any work around for this?
The text was updated successfully, but these errors were encountered: