help to deal with the problem, the post request does not reach the server and hangs on hold. I use stack of angularjs + expressjs
post request on client:
$http({ method: 'POST', url: '/api/message', headers: {'Content-Type': 'application/json'}, data: {msg: $scope.message} }). success(function(response) { console.log("Success " + JSON.stringify(response)); }). error(function(response) { console.log("Error " + JSON.stringify(response)); }); server:
app.post('/api/message', function(req,res) { var message = new Message(req.body); message.save(); res.status(200); }) I receive this message in the console:
Request URL:http://localhost:3000/api/message Request Headers Provisional headers are shown Accept:application/json, text/plain, */* Content-Type:application/json Origin:http://localhost:3000 Referer:http://localhost:3000/? User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36 Request Payload view source {msg: "231313"} msg:"231313"
req.bodyon the server, and open the project in another browser. - MrFylypenkores.status(200)tryres.status(200).send(), this will definitely send the answer to the browser. Why not save? It is necessary to add a function inside thesave(function...)method, look in the documentation better. - MrFylypenko