首页 > 其他 > 详细

graphql pass arg

时间:2017-09-18 15:41:06      阅读:255      评论:0      收藏:0      [点我收藏+]
var numSides = 6;
var numRolls = 3;
var xhr = new XMLHttpRequest();
xhr.responseType = json;
xhr.open("POST", "http://localhost:4000/graphql");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Accept", "application/json");
xhr.onload = function () {
  console.log(data returned:, xhr.response);
}
var query = `query getDiexx($numSides:Int!,$numRolls:Int!) {
  getDie(numSides: $numSides) {
  numSides 
  roll(numRolls: $numRolls)
 }
}`;
xhr.send(JSON.stringify({
  query: query,
  variables: {numSides: numSides, numRolls: numRolls},
}));

 

graphql pass arg

原文:http://www.cnblogs.com/or2-/p/7543235.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!