Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
embed graphql and resolve local running csor violation issue
- Loading branch information
1 parent
1707dc3
commit bfabccd
Showing
10 changed files
with
94 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"command": "yarn run start", | ||
"name": "Run yarn start", | ||
"request": "launch", | ||
"type": "node-terminal" | ||
} | ||
|
||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// your-app-name/src/RelayEnvironment.js | ||
import {Environment, Network, RecordSource, Store} from 'relay-runtime'; | ||
import fetchGraphQL from './fetchGraphQL'; | ||
|
||
// Relay passes a "params" object with the query name and text. So we define a helper function | ||
// to call our fetchGraphQL utility with params.text. | ||
async function fetchRelay(params, variables) { | ||
console.log(`fetching query ${params.name} with ${JSON.stringify(variables)}`); | ||
return fetchGraphQL(params.text, variables); | ||
} | ||
|
||
// Export a singleton instance of Relay Environment configured with our network function: | ||
export default new Environment({ | ||
network: Network.create(fetchRelay), | ||
store: new Store(new RecordSource()), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Rails.application.config.middleware.insert_before 0, Rack::Cors do | ||
allow do | ||
origins '*' | ||
resource '*', | ||
headers: :any, | ||
methods: [:get, :post, :put, :patch, :delete, :options, :head] | ||
end | ||
end |