Home / Function/ loader() — ui Function Reference

loader() — ui Function Reference

Architecture documentation for the loader() function in healthcheck.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  8e277aee_a662_c376_b65f_527b6f4c7aa7["loader()"]
  96e34478_5dae_a9c9_1c9f_a310f8766e43["healthcheck.tsx"]
  8e277aee_a662_c376_b65f_527b6f4c7aa7 -->|defined in| 96e34478_5dae_a9c9_1c9f_a310f8766e43
  style 8e277aee_a662_c376_b65f_527b6f4c7aa7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app/routes/healthcheck.tsx lines 6–25

export const loader = async ({ request }: LoaderFunctionArgs) => {
  const host =
    request.headers.get("X-Forwarded-Host") ?? request.headers.get("host");

  try {
    const url = new URL("/", `http://${host}`);
    // if we can connect to the database and make a simple query
    // and make a HEAD request to ourselves, then we're good.
    await Promise.all([
      prisma.user.count(),
      fetch(url.toString(), { method: "HEAD" }).then((r) => {
        if (!r.ok) return Promise.reject(r);
      }),
    ]);
    return new Response("OK");
  } catch (error: unknown) {
    console.log("healthcheck ❌", { error });
    return new Response("ERROR", { status: 500 });
  }
};

Subdomains

Frequently Asked Questions

What does loader() do?
loader() is a function in the ui codebase, defined in packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app/routes/healthcheck.tsx.
Where is loader() defined?
loader() is defined in packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app/routes/healthcheck.tsx at line 6.

Analyze Your Own Codebase

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

Try Supermodel Free