Skip to content

Instantly share code, notes, and snippets.

@r17x
Created March 17, 2021 04:57
Show Gist options
  • Select an option

  • Save r17x/76f86cf38bd636d289e1bfef1a8f36dd to your computer and use it in GitHub Desktop.

Select an option

Save r17x/76f86cf38bd636d289e1bfef1a8f36dd to your computer and use it in GitHub Desktop.
Raw Graphql Query in Browser (Pure Javascript)
// 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