blob: 7808a8546d958edbe992c28dcaf2121c66cc7b30 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)
}
|