const knowledge = [ { topic: "cv", title: "CV Explanation", content: "[Theoran's video if you don't want to read](https://www.youtube.com/watch?v=BqNyES4hCTw)\n", }, { topic: "stacking", title: "How to stack", content: "Test", }, { topic: "lm secret", title: "Love Machine Secret Waves", content: "Splits are counted as seperate players, so keep that in mind.\n1 player = Reach Wave 17\n2 players = Reach Wave 21\n3 players = Reach Wave 25\n4 players = Reach Wave 29\n5 and 6 players = Reach Wave 33", }, { topic: "old one resistances", title: "Old One resistances", content: "From Thales.\nTavern Incursion Old One:\nFeet - generic 35% nerf\nChest - 50% fire\nLeft Hand - 50% electric\nRight Hand - 50% poison\nHead - 80% nerf all\n\nGreat Old One - Ruthless TBR\nFeet - 35% generic\nChest - 50% fire\nLeft Hand - 50% electric\nRight Hand - 50% poison", }, ]; export const get = async (req, res) => { const topic = req.query.topic; if (!topic) { return res.status(400).json({ error: "no-topic" }); } if (topic == "list") { const topics = knowledge.map((v) => { return v.topic; }); return res.json({ topics }); } for (let idx = 0; idx < knowledge.length; idx++) { const t = knowledge[idx]; if (t.topic != topic) continue; return res.json({ title: t.title, content: t.content, }); } res.status(400).json({ error: "topic-not-found" }); };