Drunk-Venti-Api/pages/api/events/index.js

11 lines
306 B
JavaScript
Raw Permalink Normal View History

2022-01-15 18:07:08 +01:00
import {getEvents} from "./utils";
2023-10-19 19:43:20 +02:00
import {flatten} from "lodash";
2022-01-15 18:07:08 +01:00
export default async function handler(req, res) {
const events = await getEvents();
if (events) {
2022-07-29 22:26:06 +02:00
res.status(200).json(flatten(events));
2022-01-15 18:07:08 +01:00
} else {
res.status(404).json({message: "An error has occured"});
}
}