logo

Crowdly

Browser

Додати до Chrome

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

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

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%
Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на moodle.concordia.ca?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome