routers/goods.js
router.post('/goods', async (req, res) => {
const {goodsId, name, thumbnailUrl, category, price} = req.body; // assign seperately
const isExist = await Goods.find({ goodsId });
if (isExist.length == 0) { // no duplicated
await Goods.create({ goodsId, name, thumbnailUrl, category, price });
}
res.send({result: "success"});
});
→ to get POST method's return value, we need "insomnia"