I would like to separate my backend and my frontend with different projects using relay. The reason I'm doing this is because I'm using a particular relay/graphql backend, sangria and would like to keep the frontend development separate from the Scala development.
Would it be possible to connect a react relay frontend application on one server communicating to another graphql server backend. It seems everywhere that relay assume that its endpoint is on the same host with endpoint /graphql
The docs on Relay's network layer might be useful to you:
By default, Relay assumes that GraphQL is served at /graphql relative to the origin where our application is served. This can be re-configured by injecting a custom instantiation of the default network layer.
Relay.injectNetworkLayer( new Relay.DefaultNetworkLayer('http://example.com/graphql') );
Make sure that your graphql server allows cross-domain requests using CORS headers.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.