diff options
Diffstat (limited to 'web/routes/index.js')
| -rw-r--r-- | web/routes/index.js | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/web/routes/index.js b/web/routes/index.js index 54c53be..b2d0796 100644 --- a/web/routes/index.js +++ b/web/routes/index.js @@ -11,8 +11,9 @@ router.get('/', function(req, res, next) { /* GET Map page. */ router.get('/map', function(req,res) { - // load the map with mockdata - Mockpoints.get_dumb_points(function(err, points){ + // load the map with all the points + // Mockpoints.get_points(function(err, points){ + Points.get_points(function(err, points){ res.render('map', { lat : 43.665234, lng : -79.383370, @@ -21,4 +22,24 @@ router.get('/map', function(req,res) { }); }); +router.post('/mobilerequest', function(req, res) { + var data = { + 'coordinates': req.body.coordinates, + 'type': req.body.type, + 'isInjured': req.body.isInjured, + 'reasonForHelp': req.body.reasonForHelp, + 'ageRange': req.body.ageRange, + 'clothingDescription': req.body.clothingDescription + } + Points.save_request(data, function(err, result) { + if (err) { + console.log(`err inserting mobile request into db: ${err}`); + res.status(500).send({ error: "boo:(" }); + } else { + console.log(result); + res.status(200).send({'status': 'success', 'data': data}); + } + }); +}); + module.exports = router; |
