Maida umarnin CURL zuwa lambar HTTP Node akan layi

Curl command

Examples: GET - POST - JSON - Basic Auth - Files - Form

CURL zuwa Node HTTP akan layi

Wannan kayan aikin yana taimaka muku ƙirƙirar lambar HTTP Node bisa umarnin CURL. Kwafi da liƙa umarnin CURL kuma ƙirƙirar Node HTTP.

Me za ku iya yi da CURL zuwa Node HTTP mai musanya akan layi?

  • CURL zuwa Node HTTP kayan aiki ne na musamman don canza umarnin CURL zuwa Node HTTP buƙatar Node HTTP. Shigar da shigarwar ta hanyar umarnin CURL na mai amfani don samar da lambar HTTP Node.
  • Wannan kayan aikin yana adana lokacin ku kuma yana taimakawa ƙirƙirar lambar HTTP Node cikin sauƙi.
  • CURL zuwa Node HTTP yana aiki da kyau akan Windows, MAC, Linux, Chrome, Firefox, Edge da Safari.

menene CURL?

CURL kayan aikin layin umarni ne mai buɗewa wanda ke zazzage fayiloli daga gidan yanar gizo. Yana goyan bayan ka'idoji iri-iri, gami da Node HTTP, Node HTTPS, FTP, SFTP, TFTP, Gopher da sauransu.

Ta yaya ake canza CURL zuwa lambar HTTP Node? 

Mataki 1: Manna kuma canza buƙatun ku na CURL zuwa lambar HTTP Node

Mataki 2: Kwafi Node HTTP code

Maida CURL zuwa Misalin Node HTTP

CURL
curl example.com
Node HTTP
const http = require("http");

const options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/",
  "headers": {}
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();