I'm writing an server script with node.js which includes an request. I'm wondering if you could send an post request to local file like:
var request = require('request');
request({
method: 'POST',
url: '/v1/functions.php',
formData: {
'method': 'validate',
'id': message.id,
'token': message.token
}
}, function(error, response, body) {
if (error) {
console.log(error);
}
console.log('response: '+ response.statusCode);
console.log('body: '+ body);
});
But this is throwing an error:
Error: Invalid URI "/v1/functions.php"
It works if I use the full path:
http://localhost/something/something/v1/functions.php