Skip to content

Instantly share code, notes, and snippets.

@kreshikhin
Created February 27, 2016 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kreshikhin/6260207769400aa1410b to your computer and use it in GitHub Desktop.
Save kreshikhin/6260207769400aa1410b to your computer and use it in GitHub Desktop.
router.get('/gps/loc*', function(req, res) {
var data = {
user_id: req.query.user_id,
lat: req.query.lat,
lon: req.query.lon,
timestamp: req.query.timestamp,
hdop: req.query.hdop,
altitude: req.query.altitude,
speed: req.query.speed
};
res.write('Parsed data:' + data);
Location.create(data, function(err, location){
if(err){
res.write('Error:' + err);
res.status(500).end();
return;
}
res.write('Saved location:' + location);
res.end();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment