GG
Size: a a a
GG
BB
BB
BB
T
GG
GG
T
DI
if (error.code === "ENOTFOUND")
DI
T
CM
DI
CM
TP
router.route('/create’).post(({ body: {
title,
description,
price
} }, res) => {
const newProduct = new Product({
title,
description,
price
})
newProduct.save()
.then(() => res.json('Product has been saved'))
.catch(err => res.status(400).json('Error: ' + err))
})DI
if (error.code === "ENOTFOUND")красивее бы это написать, а то ссылаться на строку не оч
по
CM
router.route('/create’).post(({ body: {
title,
description,
price
} }, res) => {
const newProduct = new Product({
title,
description,
price
})
newProduct.save()
.then(() => res.json('Product has been saved'))
.catch(err => res.status(400).json('Error: ' + err))
})