How to use XHR API in Node.js?

前端 未结 2 2190
礼貌的吻别
礼貌的吻别 2021-02-12 19:43

This is a follow-up to my previous question

Suppose I\'ve some javascript code, which runs fine on client (in a browser). This code makes a lot of XHR

2条回答
  •  [愿得一人]
    2021-02-12 20:19

    You don't really need an XHR, since you can use http.request that comes natively with NodeJS, with it you can send GET, POST and PUT requests with headers and body.

    Here is the link to the documentation http.request.

提交回复
热议问题