You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
510 B
27 lines
510 B
var controller = require('express').Router();
|
|
var Runs = require('../models/run.js');
|
|
|
|
controller.get('/', function(req, res){
|
|
Runs.findAll().then(function(data){
|
|
res.json(data);
|
|
});
|
|
});
|
|
|
|
controller.post('/', function(req, res){
|
|
Runs.create(req.body).then(function(createdRun){
|
|
res.json(createdRun);
|
|
});;
|
|
});
|
|
|
|
controller.delete('/:id', function(req, res){
|
|
Runs.destroy({
|
|
where: {
|
|
id: req.params.id
|
|
}
|
|
}).then(function(didSucceed){
|
|
res.json(didSucceed);
|
|
});
|
|
});
|
|
|
|
module.exports = controller;
|