mirror of
https://github.com/bodyrep/DemoApp.git
synced 2026-01-25 14:43:00 +00:00
19 lines
449 B
JavaScript
19 lines
449 B
JavaScript
var workout = require('../../data/models/workout');
|
|
|
|
function loadworkout(req, res, next) {
|
|
console.log('fetch id' + req.params._id );
|
|
workout.findOne({_id: req.params._id})
|
|
//.populate('elements')
|
|
.exec(function(err, workout) {
|
|
if (err) {
|
|
return next(err);
|
|
}
|
|
if (! workout) {
|
|
return res.send('Not found', 404);
|
|
}
|
|
req.workout = workout;
|
|
next();
|
|
});
|
|
}
|
|
|
|
module.exports = loadworkout; |