problem description
vscodenode http/https connect ECONNREFUSED 127.0.0.1 3300
the environmental background of the problems and what methods you have tried
optionshostname "encrypted.google.com"
const options = {
hostname: "encrypted.google.com",
port: 443,
path: "/",
method: "GET"
};
hostname: "localhost" port: "3300"
Error: connect ECONNREFUSED 127.0.0.1 3300
related codes
/ / Please paste the code text below (do not replace the code with pictures)
const https = require("https");
const http = require("http");
const option = {
hostname: "127.0.0.1",
port: "3300",
path: "/",
method: "GET",
header: {
"Content-Type": "application/x-www-form-urlencoded",
"Content-Length": 20
}
};
let servers = https.request(option, (res) => {
console.log("", res.statusCode);
console.log("", res.headers);
res.on("data", d => {
process.stdout.write(d);
})
})
servers.on("error", err => {
console.log("Error", err);
});
servers.end();
what result do you expect? What is the error message actually seen?