Home / File/ healthcheck.tsx — ui Source File

healthcheck.tsx — ui Source File

Architecture documentation for healthcheck.tsx, a tsx file in the ui codebase. 2 imports, 0 dependents.

File tsx FrameworkTooling CLICore 2 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  96e34478_5dae_a9c9_1c9f_a310f8766e43["healthcheck.tsx"]
  ce9dd226_41a3_f031_caf3_5378288c23c1["node"]
  96e34478_5dae_a9c9_1c9f_a310f8766e43 --> ce9dd226_41a3_f031_caf3_5378288c23c1
  7b14a427_4501_6a47_9ad1_843ac38610ff["db.server"]
  96e34478_5dae_a9c9_1c9f_a310f8766e43 --> 7b14a427_4501_6a47_9ad1_843ac38610ff
  style 96e34478_5dae_a9c9_1c9f_a310f8766e43 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// learn more: https://fly.io/docs/reference/configuration/#services-http_checks
import type { LoaderFunctionArgs } from "@remix-run/node";

import { prisma } from "~/db.server";

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

Functions

Dependencies

  • db.server
  • node

Frequently Asked Questions

What does healthcheck.tsx do?
healthcheck.tsx is a source file in the ui codebase, written in tsx. It belongs to the FrameworkTooling domain, CLICore subdomain.
What functions are defined in healthcheck.tsx?
healthcheck.tsx defines 1 function(s): loader.
What does healthcheck.tsx depend on?
healthcheck.tsx imports 2 module(s): db.server, node.
Where is healthcheck.tsx in the architecture?
healthcheck.tsx is located at packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app/routes/healthcheck.tsx (domain: FrameworkTooling, subdomain: CLICore, directory: packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app/routes).

Analyze Your Own Codebase

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

Try Supermodel Free