Reputation: 2850
I am running a service and doing this CURL command which works fine - outputting a JSON reply
curl 'localhost:5000/parse?q=hello&model=MY_MODEL_PATH' | python -m json.tool
But when I convert this CURL to nodeJS code below, it is not returning any output. The program just exists. What am I missing?
var request = require('request');
var options = {
url: 'localhost:5000/parse?q=hello&model=MY_MODEL_PATH'
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
Upvotes: 0
Views: 184
Reputation: 11677
Just add "http" or "https"
var request = require('request');
var options = {
url: 'http://localhost:5000/parse?q=hello&model=MY_MODEL_PATH'
};
Upvotes: 2