I am new to node.js, I use request send the post request.but I got a error!
request({
method: 'POST',
url: config.api + '/index',
body: {
name: "name"
},
json: true
})
throw er; // Unhandled 'error' event
^
Error: Invalid protocol: 127.0.0.1:
I write this: It work fine, you can modify it like this.
request({
method: 'POST',
url: 'http://127.0.0.1:3000' + '/index',
body: {
name: "name"
},
json: true
})
Your code is incorrect: follow the instructions on the NPM module page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With