Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net web api 在Meteor中调用外部Web API有多容易?_Asp.net Web Api_Meteor - Fatal编程技术网

Asp.net web api 在Meteor中调用外部Web API有多容易?

Asp.net web api 在Meteor中调用外部Web API有多容易?,asp.net-web-api,meteor,Asp.net Web Api,Meteor,Meteor是否(或将)提供一个库来处理外部Web API调用?例如,构建与Facebook Graph API或Google电子表格API集成的Meteor应用程序。Meteor现在包括http包。首先,运行meteor add http。然后,您可以在服务器上以同步或异步方式发出HTTP请求: if (Meteor.is_server) { var http = __meteor_bootstrap__.require("http") // talk to external

Meteor是否(或将)提供一个库来处理外部Web API调用?例如,构建与Facebook Graph API或Google电子表格API集成的Meteor应用程序。

Meteor现在包括http包。首先,运行meteor add http。然后,您可以在服务器上以同步或异步方式发出HTTP请求:

if (Meteor.is_server) {
    var http = __meteor_bootstrap__.require("http")
    // talk to external HTTP API like you would in node.js
}
// server sync
res = Meteor.http.get(SOME_URL);
console.log(res.statusCode, res.data);

// server async
Meteor.http.get(SOME_URL, function (err, res) {
  console.log(res.statusCode, res.data);
});
同样的事情也适用于客户端,但是您必须使用异步表单。


HTTP在客户端和服务器上提供HTTP请求API。要使用这些功能,请使用$meteor add HTTP将HTTP包添加到项目中。

是否可以通过XHR在浏览器中调用外部HTTP API?Newbie Q-同步样式是否阻塞?所有其他传入请求都必须等待来自某个URL的响应?不要低估您的问题。。。这是一个好的。我认为@debergalis还有一个更深层次的问题,那就是async
Meteor.http.get
是从一根光纤中分离出来的,还是从它自己的光纤中派生出来的:现在,这将是非常有趣的理解-并将有助于理解一些更高层次的抽象和流星哲学!