【问题标题】:Using google-api-javascript-client with node.js将 google-api-javascript-client 与 node.js 一起使用
【发布时间】:2013-02-21 20:41:12
【问题描述】:

Google 的 API 客户端 JS 库是:https://code.google.com/p/google-api-javascript-client/wiki/GettingStarted

我想知道是否有任何方法可以将它与 node.js 一起使用

(我正在编写一个使用 google calendar api 的小应用程序。我对 node.js 很陌生)

【问题讨论】:

    标签: node.js google-api google-api-client


    【解决方案1】:

    Google 为其 API 提供了一个 node.js 客户端库:https://github.com/google/google-api-nodejs-client

    var googleapis = require('googleapis');
    googleapis.discover('calendar', 'v3').execute(function(err, client) {
      // authenticate and make requests here
    });
    

    【讨论】:

      【解决方案2】:

      js客户端支持promise。而节点客户端则没有,如wont fix。

      对我来说,这是一个很大的功能差异。有了 Promise,代码可以用生成器的方式编写,以避免回调地狱。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-06-12
        • 1970-01-01
        • 2023-04-02
        • 2013-12-27
        • 2013-09-23
        相关资源
        最近更新 更多