Home / Function/ GET() — supabase Function Reference

GET() — supabase Function Reference

Architecture documentation for the GET() function in route.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  baab62ad_c9d1_f6b8_2d9f_eab32eddc062["GET()"]
  32dd3152_4871_894d_754e_0b5325558dba["getFlattenedSections()"]
  baab62ad_c9d1_f6b8_2d9f_eab32eddc062 -->|calls| 32dd3152_4871_894d_754e_0b5325558dba
  700ecce2_94c7_f681_04ee_018b8e7249d4["htmlShell()"]
  baab62ad_c9d1_f6b8_2d9f_eab32eddc062 -->|calls| 700ecce2_94c7_f681_04ee_018b8e7249d4
  8f902070_0dce_3de1_961d_dff4c5164138["libraryNav()"]
  baab62ad_c9d1_f6b8_2d9f_eab32eddc062 -->|calls| 8f902070_0dce_3de1_961d_dff4c5164138
  a8b2ed85_9c96_f71a_d0f5_d7ba1cc4835c["sectionDetails()"]
  baab62ad_c9d1_f6b8_2d9f_eab32eddc062 -->|calls| a8b2ed85_9c96_f71a_d0f5_d7ba1cc4835c
  style baab62ad_c9d1_f6b8_2d9f_eab32eddc062 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/app/api/crawlers/route.ts lines 20–68

export async function GET(request: Request) {
  const url = new URL(request.url)
  let [, , lib, maybeVersion, slug] = url.pathname.split('/')

  const libraryMeta = REFERENCES[lib]

  const isVersion = /^v\d+$/.test(maybeVersion)
  const version = isVersion ? maybeVersion : libraryMeta.versions[0]
  if (!isVersion) {
    slug = maybeVersion
  }

  let section: AbbrevApiReferenceSection | undefined
  let sectionsWithUrl: Array<AbbrevApiReferenceSection & { url: URL }> = []
  try {
    const flattenedSections = (await getFlattenedSections(lib, version)) ?? []
    sectionsWithUrl = flattenedSections.map((section) => {
      const url = new URL(request.url)
      url.pathname = [BASE_PATH, 'reference', lib, isVersion ? version : null, section.slug]
        .filter(Boolean)
        .join('/')

      return {
        ...section,
        url,
      }
    })
    section = flattenedSections.find(
      (section) =>
        (section.type === 'markdown' || section.type === 'function') && section.slug === slug
    )
  } catch {}

  if (!section) {
    notFound()
  }

  const html = htmlShell(
    lib,
    isVersion ? version : null,
    slug,
    section,
    libraryNav(sectionsWithUrl) + (await sectionDetails(lib, isVersion ? version : null, section))
  )
  const response = new Response(html)
  response.headers.set('Content-Type', 'text/html; charset=utf-8')

  return response
}

Subdomains

Frequently Asked Questions

What does GET() do?
GET() is a function in the supabase codebase.
What does GET() call?
GET() calls 4 function(s): getFlattenedSections, htmlShell, libraryNav, sectionDetails.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free