Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Update apps/reference/docs/guides/functions.mdx

Lakshan Perera98a8f90ff3c7
diff --git a/apps/reference/docs/guides/functions.mdx b/apps/reference/docs/guides/functions.mdx
index 8cbf3cb34e0..3adcda657cd 100644
--- a/apps/reference/docs/guides/functions.mdx
+++ b/apps/reference/docs/guides/functions.mdx
@@ -287,7 +287,15 @@ We recommend using hyphens to name functions because hyphens are the most URL-fr
### CORS (Cross-Origin Resource Sharing)
-We recommend adding a check to handle [CORS Preflight](https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request) requests in your edge function. Otherwise you won't be able to invoke the function from browsers. Check this [code snippet for a example implemention](https://github.com/supabase/supabase/blob/master/examples/edge-functions/supabase/functions/browser-with-cors/index.ts#L11-L14).
+We recommend adding a check to handle [CORS Preflight](https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request) requests in your edge function to be able to invoke the function from browsers.
+
+```ts
+serve(async (req) => {
+ if (req.method === 'OPTIONS') {
+ return new Response('ok', { headers: corsHeaders })
+ }
+ ...
+})
## Limitations