From 11b55553b88dfbe8e1bd2c91720bba5da3a6c90c Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Tue, 23 Aug 2016 15:12:35 -0400 Subject: [PATCH] delete route --- controllers/runs.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/controllers/runs.js b/controllers/runs.js index b3decec..787b1d4 100644 --- a/controllers/runs.js +++ b/controllers/runs.js @@ -26,8 +26,13 @@ controller.put('/:id', function(req, res){ }); controller.delete('/:id', function(req, res){ - runs.splice(req.params.id, 1); - res.json(runs); + Run.destroy({ //destroy the run as specified by id in the url + where: { + id: req.params.id //only delete rows that have the column id set to 1 + } + }).then(function(didSucceed){ + res.json(didSucceed); //send back if it succeeded + }); }); module.exports = controller;