get events

This commit is contained in:
Maciej Kotowski committed 2021-10-02 17:26:55 +02:00
1 parent b7f66a7447
commit 311e840738
1 file changed
+2 -2
+2 -2
View File
@@ -11,9 +11,9 @@ mongoose
}) })
.then(() => console.log("connected")) .then(() => console.log("connected"))
.catch((err) => console.log(err)); .catch((err) => console.log(err));
app.get("/api", async (req, res) => { app.get("/api/getEvents", async (req, res) => {
try { try {
const event = await events.find({ mess: "one" }); const event = await events.find();
if (!event) throw Error("something went wrong"); if (!event) throw Error("something went wrong");
console.log(event); console.log(event);
res.status(200).json(event); res.status(200).json(event);