import { withDB } from "../../../../lib/database";

export default withDB(async (req, res, db) => {
  const { method } = req;
  const { Site } = db;

  switch (method) {
    case "GET":
      return Site.find({})
        .then(siteData =>
          res.status(200).json({ success: true, siteData: siteData[0] })
        )
        .then(() => res.end())
        .catch(err => res.status(400).json({ success: false, err }));
