Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- router.get('/:itemid', (req, res, next)=>{
- Photo.findOne({'_id': req.params.itemid})
- .then((photo)=>{
- res.render('update', {
- item: photo
- });
- }).catch((err)=>{
- if (err){
- console.log(err);
- }
- });
- });
- router.post('/:itemid', (req, res, next)=>{
- Photo.findOne({'_id': req.params.itemid})
- .then((photo)=>{
- var data = {
- destination: req.body.destination,
- description: req.body.description
- }
- photo.set(data);
- photo.save().then(()=>{
- res.redirect('/mylist');
- });
- }).catch((err)=>{
- if (err){
- console.log(err);
- }
- });
- });
Add Comment
Please, Sign In to add comment