Home / File/ server.ts — astro Source File

server.ts — astro Source File

Architecture documentation for server.ts, a typescript file in the astro codebase. 3 imports, 0 dependents.

File typescript IntegrationAdapters ReactIntegration 3 imports 1 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  ffcd4bd1_b7ef_bc55_5e0c_8457f822e1b3["server.ts"]
  e16a223b_37f3_6b25_1ee1_2b7bcb9d9415["node:fs"]
  ffcd4bd1_b7ef_bc55_5e0c_8457f822e1b3 --> e16a223b_37f3_6b25_1ee1_2b7bcb9d9415
  f16d8c76_2866_6150_bd14_0347b59abfe9["astro"]
  ffcd4bd1_b7ef_bc55_5e0c_8457f822e1b3 --> f16d8c76_2866_6150_bd14_0347b59abfe9
  7f3c1bdb_3a0f_c4d2_17d3_31a407595fc8["app"]
  ffcd4bd1_b7ef_bc55_5e0c_8457f822e1b3 --> 7f3c1bdb_3a0f_c4d2_17d3_31a407595fc8
  style ffcd4bd1_b7ef_bc55_5e0c_8457f822e1b3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as fs from 'node:fs';
import type { SSRManifest } from 'astro';
import { AppPipeline, BaseApp } from 'astro/app';

class MyApp extends BaseApp {
	#manifest: SSRManifest | undefined;
	constructor(manifest: SSRManifest, streaming = false) {
		super(manifest, streaming);
		this.#manifest = manifest;
	}

	isDev(): boolean {
		return false;
	}

	async render(request: Request) {
		const url = new URL(request.url);
		if (this.#manifest?.assets.has(url.pathname)) {
			const filePath = new URL('../../client/' + this.removeBase(url.pathname), import.meta.url);
			const data = await fs.promises.readFile(filePath);
			return new Response(Buffer.from(data));
		}

		return super.render(request);
	}

	createPipeline(streaming: boolean) {
		return AppPipeline.create({
			manifest: this.manifest,
			streaming,
		});
	}
}

export function createExports(manifest: SSRManifest) {
	return {
		manifest,
		createApp: (streaming: boolean) => new MyApp(manifest, streaming),
	};
}

Subdomains

Functions

Classes

Dependencies

  • app
  • astro
  • node:fs

Frequently Asked Questions

What does server.ts do?
server.ts is a source file in the astro codebase, written in typescript. It belongs to the IntegrationAdapters domain, ReactIntegration subdomain.
What functions are defined in server.ts?
server.ts defines 1 function(s): createExports.
What does server.ts depend on?
server.ts imports 3 module(s): app, astro, node:fs.
Where is server.ts in the architecture?
server.ts is located at benchmark/packages/adapter/src/server.ts (domain: IntegrationAdapters, subdomain: ReactIntegration, directory: benchmark/packages/adapter/src).

Analyze Your Own Codebase

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

Try Supermodel Free