import express from "express";
const EventdayUeuse = express.Router();

import EventDays from "../../scripts/eventday.js";

EventdayUeuse.post("/actions/eventday", (req, res) => {
  try {
    (async () => {
      await EventDays();
    })();

    res.status(202)
    .send("Accepted");
  } catch(err) {
    res.status(500)
    .send(`Error: ${err}`);
  }
});

EventdayUeuse.get("/actions/eventday", (req, res) => {
  res.status(501)
  .send("POST Only");
});

export default EventdayUeuse;
