@supabase/server - v0.2.0
    Preparing search index...

    Function withSupabase

    • Wraps a request handler with Supabase auth, client creation, and CORS handling.

      Built for the Web API Request/Response standard that all modern runtimes implement natively. Handles CORS preflight, credential verification, context creation, and error responses. Your handler only runs on successful auth.

      Type Parameters

      • Database = unknown

      Parameters

      Returns (req: Request) => Promise<Response>

      A (req: Request) => Promise<Response> fetch handler.

      import { withSupabase } from '@supabase/server'

      export default {
      fetch: withSupabase({ allow: 'user' }, async (req, ctx) => {
      const { data } = await ctx.supabase.rpc('get_my_profile')
      return Response.json(data)
      }),
      }