Professional Documents
Culture Documents
Wings1 T1 Nodejs APIs (62637)
Wings1 T1 Nodejs APIs (62637)
Wings1 T1 Nodejs APIs (62637)
me/fresco_milestone
( @fresco_milestone )
const e = require("express");
}
})
err.status = 400
next(err)
} else if (data.costPrice <= 0) {
const err = new Error("cost price value cannot be zero or negative
value")
err.status = 400
next(err)
value")
err.status = 400
next(err)
} else {
await data.save();
res.status(201).json({ message: "Product Added" })
}
} catch (err) {
res.status(200@) .json(data)
})
try {
const data = req.body.soldPrice;
if (data <= @) {
const err = new Error("sold price value cannot be zero or negative
value")
err.status = 460
next (err)
} else {
res.status(20@).json({ message: "Updated Successfully" })
}
} catch (err) {
res.status(20@) .json(data)
})
res.status(40@) .json(data)
}
const data = await SellBuy.findByIdAndDelete(id)
})
}
next();
})3
app.use('/sellProduct', sellAndBuyRouter) ;
})
module.exports = app;