Open DrYSG opened 4 years ago
The app should load in localhost:8080
I am not trying to be dense. (at least not deliberately, but I don't mind if you call me names :-) )
The server is starting in localhost:8080. I can see the graphiql interface, I can use insomnia to call against it, etc. and the mutations and queries all work fine.
I also see that when I edited line in Loader.re (in the client) as shown above - the server is logging to the console "/graphql" when the message arrives. (so there is connectivity).
What I did notice in with Fiddler is that post request packet had no body after I modified Loader.re
If I leave it (loader.re) alone, it does have a body, but then it sends the request to http://localhost/public/graphql (where there is no server)
So I think I am not editing Loader.re in the React client properly.
I don't know what to tell you. I haven't touched this app in a while and it worked when I pushed it.
I'd encourage others to chime in if it's not working for them. I don't use Esy anymore so I can't double check if the setup works.
So let me chime in this:
@anmonteiro you mention you no longer use Esy, What was the problem, and what do you use now?
@anmonteiro ,
I found the problem. It is simple there is no header on the server to deal with the CORS issue:
Access to fetch at 'http://localhost:8080/graphql' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: 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.
Do you know who I should ask about how to add header on the responses for CORS" is it Cohttp_lwt_unix or Cohttp_lwt_unix.Server
Trivial question: (BTW, very nice project, this helps me a lot)
I see the the sample client tries to connect to http://localhost/public which is not where the server is located.
I tried changing the line in Loader.re to:
But my newbie knowledge of Bs_fetch is obviously flawed. Fidder reports that this is what is being sent: