Hi i already have one api in laravel, but i need access with express node js.
This is my funcition
var data = querystring.stringify({
_token: 'LhTsymoueRtcWtjP69MD1KEbDyGl0NGuewWOieER',
propertiesString: properties
});
var options = {
hostname: 'apiproperties.local',
port: 80,
path: '/properties/storeSB',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(data)
}
/*headers: {
'Content-Type': 'application/json',
}*/
};
var req = http.request(options, function(res) {
res.setEncoding('utf8');
console.log('Status: ' + res.statusCode);
console.log('Headers: ' + JSON.stringify(res.headers));
res.on('data', function (chunk) {
console.log("body: " + chunk);
});
});
req.write(data);
req.end();
This give me error Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php line 68 because i dont send _token, but i dont know how send token in nodejs i not have views in nodejs because i not want to use i not need it, so how send token in my post request without call for form in one view? regards
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…