martin
09/30/2017, 12:51 AMmyapi.generate()), those codes then get stored in my graphcool account, and at some point my client’s customers would then consume the codes (myapi.destroy('DKns83l2dn39'), at which point they’d get deleted. So far I’ve only worked with GraphQL in one and the same project. Do you know of any resources I could use graphcool for to “build” an API that my client could then use in various other places and websites? How would that even work?max
09/30/2017, 12:56 AMmax
09/30/2017, 12:57 AMmartin
09/30/2017, 12:58 AMmax
09/30/2017, 1:02 AMmax
09/30/2017, 1:03 AMmartin
09/30/2017, 1:04 AMmax
09/30/2017, 1:04 AMmax
09/30/2017, 1:04 AMmax
09/30/2017, 1:05 AMmax
09/30/2017, 1:05 AMmartin
09/30/2017, 1:05 AMmax
09/30/2017, 1:06 AMmax
09/30/2017, 1:06 AMmartin
09/30/2017, 1:07 AMmax
09/30/2017, 1:07 AMmax
09/30/2017, 1:08 AMmartin
09/30/2017, 1:08 AMmax
09/30/2017, 1:08 AMmartin
09/30/2017, 1:09 AM<https://www.mywebsite.com/api/codegenerator.js> and tell him to put this code myapi.generate() inside his javascript to generate a code, and myapi.destroy('couponcode') to destroy a coupon.max
09/30/2017, 1:12 AMmartin
09/30/2017, 1:12 AMmax
09/30/2017, 1:12 AMagartha
09/30/2017, 9:21 AMagartha
09/30/2017, 9:23 AMagartha
09/30/2017, 9:31 AMwindow.myapi = (function () {
var myapi = {
generate: function () {
fetch("__API_ENDPOINT", {
method: "POST",
body: JSON.stringify("{ query: { getCouponCode { couponcode } }")
.then(function(json) { return .... })
}
destroy: function(couponcode) {
fetch(......)
}
};
return myapi;
}());agartha
09/30/2017, 9:32 AMmartin
09/30/2017, 5:23 PMmartin
09/30/2017, 5:30 PMagartha
09/30/2017, 5:32 PMmartin
09/30/2017, 5:46 PMwindow.myapi means that the client can use myapi.generate() locally?agartha
09/30/2017, 6:07 PMagartha
09/30/2017, 6:08 PMmartin
09/30/2017, 6:08 PM__API_ENDPOINT__?eruby
09/30/2017, 6:08 PMmartin
09/30/2017, 6:09 PMeruby
09/30/2017, 6:09 PMeruby
09/30/2017, 6:10 PMagartha
09/30/2017, 6:10 PMgraphcool info, or in the Consolemartin
09/30/2017, 6:11 PMmartin
09/30/2017, 6:11 PMJSON.stringify("{ query: { getCouponCode { couponcode } }") then contains the GraphQL code, right?agartha
09/30/2017, 6:11 PMmartin
09/30/2017, 6:12 PMagartha
09/30/2017, 6:12 PMeruby
09/30/2017, 6:12 PMeruby
09/30/2017, 6:15 PMmartin
09/30/2017, 10:05 PMeruby
09/30/2017, 10:11 PMmartin
09/30/2017, 10:12 PMeruby
09/30/2017, 10:13 PM