Files
supabase/apps/docs/spec/reference/javascript/edge-functions.partial.mdx
T
2026-05-05 21:06:58 +02:00

20 lines
570 B
Plaintext

## CORS headers for Edge Functions
Default CORS headers for Supabase Edge Functions.
Includes all headers sent by Supabase client libraries and allows all standard HTTP methods. Use this for simple CORS configurations with wildcard origin.
```ts
import { corsHeaders } from '@supabase/supabase-js/cors'
Deno.serve(async (req) => {
if (req.method === 'OPTIONS') {
return new Response('ok', { headers: corsHeaders })
}
return new Response(JSON.stringify({ data: 'Hello' }), {
headers: { ...corsHeaders, 'Content-Type': 'application/json' },
})
})
```