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

import { weatherNotice } from "../../scripts/weatherNotice.js";

WeatherUeuse.post("/actions/weather", (req, res) => {
  try {
    (async () => {
      await weatherNotice();
    })();

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

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

export default WeatherUeuse;
