Answer the question
In order to leave comments, you need to log in
How to post raw data to node.js server?
Good time of the day. I wrote a small server in node.js, but I can't figure out how the post method is passed to the server. There is a Route
.post(function(req, res) {
var device = new Device();
device.uuid = req.body.uuid;
device.location.coordinates = req.body.location.coordinates;
device.type = req.body.type;
device.save(function(err) {
if (err)
res.send(err);
res.json({ message: 'Device created!' });
});
})
{
"uuid": "device 12",
"location": {
"coordinates": [-110.0, 110.20]
}
}
and the data is successfully received by the server and written to the database. the path by which the postman sends data to localhost/api/devicesAnswer the question
In order to leave comments, you need to log in
do I need to explain the difference between POST and GET? Why are there so many drug addicts on this resource?
what's with the drug addicts? if you do not want and do not want to help, then there is no reason for him to write about it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question