I am new in NodeJS
, I have a file named "employe.html" and I want to use curl
in this file, so for testing the curl
I put following code but it's showing nothing.
Can I use curl
in this file? If yes then where I am wrong?
Here is my current code:
var request = require('request');
request('http://www.google.com', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body) // Show the HTML for the Google homepage.
req.write('hello');
}
else {
console.log("Error "+response.statusCode)
req.write('hellos');
}
})