Reputation: 599
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
Upvotes: 4
Views: 802
Reputation: 12867
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.
Upvotes: 5