【问题标题】:How to call 3rd party api like Gandi.Net from Node (server.js)如何从 Node (server.js) 调用像 Gandi.Net 这样的 3rd 方 api
【发布时间】:2017-07-03 22:51:43
【问题描述】:

我是 Node.Js 的新手,我正在创建一个 Mean Stack 应用程序,我想在其中从我的 Node.js 代码调用第 3 方 API Gandi.Net

我的 Node.Js 加上 Express 应用程序正在用于制作基于休息的 API,该 API 正在被我的 Angular 客户端使用。

我从这个链接https://github.com/baalexander/node-xmlrpc 找到了一点帮助。但不是那么多。

我需要为 XML-RPC 制作新的服务器吗? 如果有人做过这种工作,那么任何示例应用程序都会有很大帮助。

如果有人从节点应用程序进行了任何 http 调用,那么示例应用程序将有所帮助。

【问题讨论】:

    标签: node.js angular rest express xml-rpc


    【解决方案1】:

    从节点服务器发起 http 调用非常容易。
    您可以使用request 模块。

    该文档也有大量示例。

    模块本身的一个非常简单的例子

    var request = require('request'); 
    request('http://www.google.com', 
    function (error, response, body
    { 
      console.log('error:', error); // Print the error if one occurred 
      console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received 
    
      console.log('body:', body); // Print the HTML for the Google homepage. 
    });  
    

    【讨论】:

    • 谢谢,您有任何包含模型类、控制器和路由的示例应用程序吗?
    • 快速搜索显示this sample mean stack app。
    猜你喜欢
    • 1970-01-01
    • 2021-12-09
    • 1970-01-01
    • 2020-09-09
    • 1970-01-01
    • 2016-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多