diff options
Diffstat (limited to 'src/api/routes/discovery.ts')
-rw-r--r-- | src/api/routes/discovery.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/api/routes/discovery.ts b/src/api/routes/discovery.ts new file mode 100644 index 00000000..30c418c6 --- /dev/null +++ b/src/api/routes/discovery.ts @@ -0,0 +1,18 @@ +import { Categories } from "@fosscord/util"; +import { Router, Response, Request } from "express"; +import { route } from ".."; + +const router = Router(); + +router.get("/categories", route({}), async (req: Request, res: Response) => { + // TODO: + // Get locale instead + + const { locale, primary_only } = req.query; + + const out = primary_only ? await Categories.find() : await Categories.find({ where: {is_primary: true} }); + + res.send(out); +}); + +export default router; |