Add edge function placeholder
This commit is contained in:
46
supabase/volumes/functions/main/index.ts
Normal file
46
supabase/volumes/functions/main/index.ts
Normal file
@@ -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<Response> {
|
||||
// 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<Response> {
|
||||
// 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
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user