Как поместить переменную DataG в {host: в http.get?
let Data = "";
server.get("/last", (req,res) => {
res.sendFile("index.html", {root: __dirname});
})
server.post("/last", (req,res) => {
var DataG = (req.body.name)
Data = DataG;
console.log(Data) // this is my variable
})
http.get({ host: `www.google.com` }, function(res) {
if (res.statusCode == 200)
console.log("server is up")
else {
console.log("website is maybe down")
}
})
Подробнее здесь: https://stackoverflow.com/questions/798 ... n-http-get