A powerful and extendable Discord bot, with it's own module system :3 thevoid.cafe/projects/voidy

✨ Add GET /items endpoint

Changed files
+16
packages
api
routes
api
v1
+16
packages/api/routes/api/v1/shop.ts
··· 14 14 return c.json(latestShop); 15 15 }); 16 16 17 + shop.get("/items", async (c) => { 18 + const item = c.req.query("item"); 19 + 20 + if (!item) { 21 + return c.json({ error: "Item query parameter is required" }, 400); 22 + } 23 + 24 + const locatedItem = await MinecraftShopItem.findOne({ item }); 25 + 26 + if (!locatedItem) { 27 + return c.json({ error: "No item with that ID found" }, 404); 28 + } 29 + 30 + return c.json(locatedItem); 31 + }); 32 + 17 33 shop.post("/generate", isAuthenticated, async (c) => { 18 34 const body = await c.req.json().catch(() => ({})); 19 35 const { highlight } = body as { highlight?: string };