Node.js http request error

the https module using node.js always reports an error message:
getaddrinfo ENOTFOUND is followed by my host
and the value of path is not concatenated

.

could you tell me how to do this? Here is the code.

const postData = querystring.stringify({
  action: "getAuth",                 //
  key: "rcJ27M9jMqyvnH5d7xVCO8KtS2ELtpbT8xVDXQQtpiyNDeTrIMcXqK4O911N7jd9",                 // access key
  devices: ["5285dded85d52222262f4f0389985704"],  
  valid: 3600,           // 3600
  time: date
});

const options = {
  protocol: "https:",
  host: "https://storeauth.touchsprite.com",
  path: "/api/openapi",
  method: "POST",
  headers: {
    "Content-Type": "application/x-www-form-urlencoded",
    "Content-Length": Buffer.byteLength(postData)
  }
};


const req = https.request(options, (res) => {
  htm=""
  console.log(`: ${res.statusCode}`);
  console.log(`: ${JSON.stringify(res.headers)}`);
  res.setEncoding("utf8");
  res.on("data", (chunk) => {
    console.log(`: ${chunk}`);
    html+=chunk
  });
  res.on("end", () => {
    console.log(html);
  });
});

req.on("error", (e) => {
  console.error(`: ${e.message}`);
});

// 
req.write(postData);
req.end();
Mar.04,2021

const options = {
  protocol: 'https:',
  host: 'storeauth.touchsprite.com',
  path: '/api/openapi',
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded',
    'Content-Length': Buffer.byteLength(postData)
  }
};
Menu