Skip to content

Commit

Permalink
get all events
Browse files Browse the repository at this point in the history
  • Loading branch information
riyap committed Apr 24, 2024
1 parent ca5fcef commit 77495f3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/services/events/events-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,17 @@ eventRouter.get("/:eventId", async (req, res, next) => {
}
});

eventRouter.get("/", async (req, res, next) => {
try {
const events = await Database.EVENTS.find({});

if (!events) {
return { error: "No events" };
}
return res.status(StatusCodes.OK).json(events);
} catch (error) {
next(error);
}
});

export default eventRouter;

0 comments on commit 77495f3

Please sign in to comment.