Home / File/ entry.server.tsx — ui Source File

entry.server.tsx — ui Source File

Architecture documentation for entry.server.tsx, a tsx file in the ui codebase. 5 imports, 0 dependents.

File tsx FrameworkTooling CLICore 5 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  28fbe87d_bb74_73af_6290_ba685d687fe8["entry.server.tsx"]
  1a1315eb_ec06_1cc9_65fd_386661de9b1f["node:stream"]
  28fbe87d_bb74_73af_6290_ba685d687fe8 --> 1a1315eb_ec06_1cc9_65fd_386661de9b1f
  ce9dd226_41a3_f031_caf3_5378288c23c1["node"]
  28fbe87d_bb74_73af_6290_ba685d687fe8 --> ce9dd226_41a3_f031_caf3_5378288c23c1
  b969017e_0ead_3c70_277e_2e4416d7a8ed["react"]
  28fbe87d_bb74_73af_6290_ba685d687fe8 --> b969017e_0ead_3c70_277e_2e4416d7a8ed
  b1968bdc_3b4b_1971_0f15_cabe4c85d1f6["isbot"]
  28fbe87d_bb74_73af_6290_ba685d687fe8 --> b1968bdc_3b4b_1971_0f15_cabe4c85d1f6
  e8da4ed9_051a_2894_c6f1_55589a05534e["server"]
  28fbe87d_bb74_73af_6290_ba685d687fe8 --> e8da4ed9_051a_2894_c6f1_55589a05534e
  style 28fbe87d_bb74_73af_6290_ba685d687fe8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * By default, Remix will handle generating the HTTP Response for you.
 * You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨
 * For more information, see https://remix.run/docs/en/main/file-conventions/entry.server
 */

import { PassThrough } from "node:stream";

import type { EntryContext } from "@remix-run/node";
import { createReadableStreamFromReadable } from "@remix-run/node";
import { RemixServer } from "@remix-run/react";
import { isbot } from "isbot";
import { renderToPipeableStream } from "react-dom/server";

const ABORT_DELAY = 5_000;

export default function handleRequest(
  request: Request,
  responseStatusCode: number,
  responseHeaders: Headers,
  remixContext: EntryContext,
) {
  return isbot(request.headers.get("user-agent"))
    ? handleBotRequest(
        request,
        responseStatusCode,
        responseHeaders,
        remixContext,
      )
    : handleBrowserRequest(
        request,
        responseStatusCode,
        responseHeaders,
        remixContext,
      );
}

function handleBotRequest(
  request: Request,
  responseStatusCode: number,
  responseHeaders: Headers,
  remixContext: EntryContext,
) {
  return new Promise((resolve, reject) => {
    const { abort, pipe } = renderToPipeableStream(
      <RemixServer
        context={remixContext}
        url={request.url}
        abortDelay={ABORT_DELAY}
      />,
      {
        onAllReady() {
          const body = new PassThrough();

          responseHeaders.set("Content-Type", "text/html");

          resolve(
            new Response(createReadableStreamFromReadable(body), {
              headers: responseHeaders,
              status: responseStatusCode,
// ... (61 more lines)

Subdomains

Dependencies

  • isbot
  • node
  • node:stream
  • react
  • server

Frequently Asked Questions

What does entry.server.tsx do?
entry.server.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 entry.server.tsx?
entry.server.tsx defines 3 function(s): handleBotRequest, handleBrowserRequest, handleRequest.
What does entry.server.tsx depend on?
entry.server.tsx imports 5 module(s): isbot, node, node:stream, react, server.
Where is entry.server.tsx in the architecture?
entry.server.tsx is located at packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app/entry.server.tsx (domain: FrameworkTooling, subdomain: CLICore, directory: packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app).

Analyze Your Own Codebase

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

Try Supermodel Free