From 7c6dbef44331a5ed85c507a7b74de4da68e7484f Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 12 Dec 2025 10:42:35 +0100 Subject: [PATCH] Add edge function placeholder --- supabase/volumes/functions/main/index.ts | 46 ++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 supabase/volumes/functions/main/index.ts diff --git a/supabase/volumes/functions/main/index.ts b/supabase/volumes/functions/main/index.ts new file mode 100644 index 0000000..975e8e4 --- /dev/null +++ b/supabase/volumes/functions/main/index.ts @@ -0,0 +1,46 @@ +// Main edge function entry point +import { serve } from "https://deno.land/std@0.177.0/http/server.ts" + +serve(async (req: Request) => { + const url = new URL(req.url) + const pathname = url.pathname + + // Route to different functions based on path + if (pathname === "/trigger-n8n" || pathname === "/functions/v1/trigger-n8n") { + return await handleTriggerN8n(req) + } + + if (pathname === "/n8n-callback" || pathname === "/functions/v1/n8n-callback") { + return await handleN8nCallback(req) + } + + return new Response(JSON.stringify({ + message: "Mylder Edge Functions", + available: ["/trigger-n8n", "/n8n-callback"] + }), { + headers: { "Content-Type": "application/json" }, + status: 200 + }) +}) + +async function handleTriggerN8n(req: Request): Promise { + // Will be implemented when connecting to n8n + return new Response(JSON.stringify({ + status: "placeholder", + message: "trigger-n8n function - to be implemented" + }), { + headers: { "Content-Type": "application/json" }, + status: 200 + }) +} + +async function handleN8nCallback(req: Request): Promise { + // Will be implemented when connecting to n8n + return new Response(JSON.stringify({ + status: "placeholder", + message: "n8n-callback function - to be implemented" + }), { + headers: { "Content-Type": "application/json" }, + status: 200 + }) +}