Created
March 17, 2021 04:57
-
-
Save r17x/76f86cf38bd636d289e1bfef1a8f36dd to your computer and use it in GitHub Desktop.
Raw Graphql Query in Browser (Pure Javascript)
This file contains hidden or 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
| // UNCOMMENT when run in node | |
| // let fetch = require("node-fetch"); | |
| let GQL_URI = "https://api.graphql.jobs/"; | |
| let query = `query{ | |
| jobs{ | |
| title | |
| description | |
| company{ | |
| name | |
| } | |
| remotes{ | |
| slug | |
| } | |
| } | |
| }`; | |
| let body = JSON.stringify({ | |
| operationName: null, | |
| variables: {}, | |
| query, | |
| }); | |
| fetch(GQL_URI, { | |
| method: "post", | |
| headers: { "Content-Type": "application/json" }, | |
| body, | |
| }) | |
| .then((r) => r.json()) | |
| .then(console.log) | |
| .catch(console.error); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment