Updated code for createProduct controller

master
parent 9c75c2edb1
commit 232180bb1e

@ -17,16 +17,16 @@ module.exports.createProduct = async (req, res) => {
name,
price,
description,
inventory,
inventory
});
// Save the product to the database
await product.save();
res.status(201).json({ message: 'Product created successfully', product });
res.status(201).json(true);
} catch (error) {
console.error(error);
res.status(500).json({ message: 'Error creating product' });
res.status(500).json(false);
}
};

Loading…
Cancel
Save