LouisLam
3 years ago
6 changed files with 62 additions and 57 deletions
@ -1,19 +1,19 @@ |
|||||
var http = require("http"); |
let http = require("http"); |
||||
var options = { |
let options = { |
||||
host: "localhost", |
host: "localhost", |
||||
port: "3001", |
port: "3001", |
||||
timeout: 2000, |
timeout: 2000, |
||||
}; |
}; |
||||
var request = http.request(options, (res) => { |
let request = http.request(options, (res) => { |
||||
console.log(`STATUS: ${res.statusCode}`); |
console.log(`STATUS: ${res.statusCode}`); |
||||
if (res.statusCode == 200) { |
if (res.statusCode == 200) { |
||||
process.exit(0); |
process.exit(0); |
||||
} else { |
} else { |
||||
process.exit(1); |
process.exit(1); |
||||
} |
} |
||||
}); |
}); |
||||
request.on("error", function (err) { |
request.on("error", function (err) { |
||||
console.log("ERROR"); |
console.log("ERROR"); |
||||
process.exit(1); |
process.exit(1); |
||||
}); |
}); |
||||
request.end(); |
request.end(); |
||||
|
Loading…
Reference in new issue