【问题标题】:Can you make a GET request in node.js without the HTTP module你可以在没有 HTTP 模块的 node.js 中发出 GET 请求吗
【发布时间】:2016-05-27 22:19:53
【问题描述】:

有没有一种方法可以在 Node 中发出基本的 GET 请求,而无需任何额外的模块,甚至是核心模块?我知道这可以使用 XMLHttpRequest() 在 vanilla javascript 中完成,但这仅在浏览器中可用。

【问题讨论】:

    标签: node.js http get


    【解决方案1】:

    据我所知,没有。

    您需要创建网络套接字的能力,而在 Node.js 中做到这一点的唯一方法(据我所知)要么使用 net 模块,要么使用任何 C/C++ 插件.

    默认设置的http 模块在后台使用net 模块。

    XMLHttpRequest is not part of the actual ECMAScript specification.

    【讨论】:

      猜你喜欢
      • 2011-02-28
      • 2021-11-16
      • 2021-09-07
      • 2019-04-14
      • 1970-01-01
      • 1970-01-01
      • 2023-03-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多