From b4f295bf46574efda17500bd9fc3a8ce2ee51bfa Mon Sep 17 00:00:00 2001 From: Neshura Date: Tue, 2 Jan 2024 02:09:07 +0100 Subject: [PATCH] API endpoint listing all icons in icons directory --- src/routes/assets/icons/+server.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/routes/assets/icons/+server.ts diff --git a/src/routes/assets/icons/+server.ts b/src/routes/assets/icons/+server.ts new file mode 100644 index 0000000..30087b5 --- /dev/null +++ b/src/routes/assets/icons/+server.ts @@ -0,0 +1,10 @@ +import * as fs from "fs"; +import {json} from "@sveltejs/kit"; + +export function GET() { + let content = fs.readdirSync("static/assets/icons"); + + content = content.filter((entry) => entry != ".directory") + + return json(content); +} \ No newline at end of file