From 466f637207da92e49626bad75220906063814ad0 Mon Sep 17 00:00:00 2001 From: Neshura Date: Tue, 2 Jan 2024 02:09:23 +0100 Subject: [PATCH] API endpoint returning /data/services.json --- src/routes/data/services/+server.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/routes/data/services/+server.ts diff --git a/src/routes/data/services/+server.ts b/src/routes/data/services/+server.ts new file mode 100644 index 0000000..652b3e1 --- /dev/null +++ b/src/routes/data/services/+server.ts @@ -0,0 +1,10 @@ +import * as fs from "fs"; +import {json} from "@sveltejs/kit"; + +export function GET() { + const content = fs.readFileSync("static/data/services.json").toString(); + + let data = JSON.parse(content) + + return json(data); +} \ No newline at end of file