Drunk-Venti-Api/pages/api/events/index.js
2023-10-19 19:43:20 +02:00

11 lines
No EOL
306 B
JavaScript

import {getEvents} from "./utils";
import {flatten} from "lodash";
export default async function handler(req, res) {
const events = await getEvents();
if (events) {
res.status(200).json(flatten(events));
} else {
res.status(404).json({message: "An error has occured"});
}
}