logo

Crowdly

Browser

Add to Chrome

The code below was extracted from the class. Knowing that you have the follo...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

The code below was extracted

from the class.

Knowing that you have the

following project hierarchy.

Analyze the code below and

choose only the correct answers

There are 4 correct answers.

Each correct answer adds 25% to the question's grade.

Each wrong answer chosen reduces the question's grade by 25%.

Project Hierarchy

File: server\app\controllers\product.controller.js

  1. const db = require('../models')
  2. const Product = db.products
  3. const Op = db.Sequelize.Op
  4. exports.update = (req, res) => {
  5.     const id = req.params.id;
  6.     Product.update(req.body, {
  7.       where: { id: id }
  8.     })
  9.       .then(num => {
  10.         if (num == 1) {
  11.           res.send({
  12.             message: 'Product was updated successfully.'
  13.           });
  14.         } else {
  15.           res.send({
  16.             message: `Cannot update product with id=${id}. Maybe product was not found or is empty!`
  17.           });
  18.         }
  19.       })
  20.       .catch(err => {
  21.         res.status(500).send({
  22.           message: `Error updating Product with id=${id}`
  23.         })
  24.       })  
  25.   }

0%
0%
0%
0%
More questions like this

Want instant access to all verified answers on moodle.concordia.ca?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome