using req.body to create run in DB

master
Matt Huntington 9 years ago
parent 18bfb99ca5
commit 850e79afd8

@ -11,10 +11,7 @@ controller.get('/:id', function(req, res){
}); });
controller.post('/', function(req, res){ controller.post('/', function(req, res){
Run.create({ Run.create(req.body).then(function(createdRun){
date: new Date('2016-1-1'),
distance: 5.5
}).then(function(createdRun){
//createdRun is the object representation of the row created in the DB //createdRun is the object representation of the row created in the DB
res.json(createdRun); res.json(createdRun);
}); });

Loading…
Cancel
Save