API
Data Interaction

Data Interaction

CRUD Operations

  • Create : seed.js file is the beginning point to set Database
const handler = async (req, res) => {
  await db.connect();
  await User.deleteMany();
  await User.insertMany(data.users);
  await Product.deleteMany();
  await Product.insertMany(data.products);
  await db.disconnect();
  res.send({ message: "seeded successfully" });
};
  • Read: Functions in /utils/API.js file
  • Update:
  • Delete: