summaryrefslogtreecommitdiffstats
path: root/graphcool-old/src/getPrice.js
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-01-30 12:39:31 -0500
committerWes Bos <wesbos@gmail.com>2018-01-30 12:39:31 -0500
commit0a1648bf47490b312169c531aeb51ef4725e8d2e (patch)
treea9c3dd7b50bc8dd563d9efeee3eeafaca1b3019a /graphcool-old/src/getPrice.js
parent0f1b9240bbd05b377e868faf78b89b509a3d7537 (diff)
Saying goodbye to graphcool
Diffstat (limited to 'graphcool-old/src/getPrice.js')
-rw-r--r--graphcool-old/src/getPrice.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/graphcool-old/src/getPrice.js b/graphcool-old/src/getPrice.js
new file mode 100644
index 0000000..7808a85
--- /dev/null
+++ b/graphcool-old/src/getPrice.js
@@ -0,0 +1,26 @@
+require('isomorphic-fetch')
+
+const query = `
+query SingleItem {
+ Item(id: "cj64bs7vuuqgu0116ul5cm223") {
+ price
+ }
+}
+`;
+
+function getItem(id) {
+ return fetch('https://api.graph.cool/simple/v1/cj5xz8szs28930145gct82bdj', {
+ method: 'post',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({ query }),
+ })
+}
+
+
+module.exports = function(event) {
+ getItem().then(x => x.json()).then(res => {
+ console.log(res.data.Item.price);
+ }).catch(console.log)
+}