From e318e4fa6031c728d542f143097ec1691e00acb4 Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Tue, 23 Aug 2016 15:37:53 -0400 Subject: [PATCH] put route --- controllers/runs.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/controllers/runs.js b/controllers/runs.js index c0180e6..5db4262 100644 --- a/controllers/runs.js +++ b/controllers/runs.js @@ -27,8 +27,16 @@ controller.post('/', function(req, res){ }); controller.put('/:id', function(req, res){ - runs[req.params.id] = req.body; - res.json(runs); + Run.update( + req.body, //change the selected runs to match this object + { + where: { + id: req.params.id //only update rows that have the column id set to 1 + } + } + ).then(function(didSucceed){ + res.json(didSucceed); //respond with success status + }); }); controller.delete('/:id', function(req, res){