{"size": 578, "ext": "js", "max_stars_repo_path": "pages/api/quizzes/quizquestions/[id].js", "max_stars_repo_name": "Schrodinger-Elephant/aic-fe2", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "pages/api/quizzes/quizquestions/[id].js", "max_issues_repo_name": "Schrodinger-Elephant/aic-fe2", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "pages/api/quizzes/quizquestions/[id].js", "max_forks_repo_name": "Schrodinger-Elephant/aic-fe2", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.0833333333, "max_line_length": 73, "alphanum_fraction": 0.6003460208}
import Quizquestion from "../../../../data/models/Quizquestion";
import dbConnect from "../../../../utils/dbConnect";

export default async function handler(req, res) {
  const {
    query: { id },
    method,
  } = req;

  dbConnect();

  switch (method) {
    case "GET":
      const quizQuestion = await Quizquestion.findById(id).exec();
      if (quizQuestion === null || quizQuestion === undefined) {
        return res.status(200).json({ success: false });
      }
      return res.status(200).json({ success: true, data: quizQuestion });

    default:
      break;
  }
}
