Home / Function/ readHeadersJson() — astro Function Reference

readHeadersJson() — astro Function Reference

Architecture documentation for the readHeadersJson() function in server.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  5ad5eb83_7bec_ad82_1f09_03d3cc805651["readHeadersJson()"]
  3d1ffe9b_acaf_0628_7657_d34856e4c8a2["server.ts"]
  5ad5eb83_7bec_ad82_1f09_03d3cc805651 -->|defined in| 3d1ffe9b_acaf_0628_7657_d34856e4c8a2
  466c5b6b_fce0_d771_2e3b_90f035b25fea["createExports()"]
  466c5b6b_fce0_d771_2e3b_90f035b25fea -->|calls| 5ad5eb83_7bec_ad82_1f09_03d3cc805651
  c8736ba9_969c_c9f7_d537_be94cf1c43cd["start()"]
  c8736ba9_969c_c9f7_d537_be94cf1c43cd -->|calls| 5ad5eb83_7bec_ad82_1f09_03d3cc805651
  style 5ad5eb83_7bec_ad82_1f09_03d3cc805651 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/node/src/server.ts lines 50–64

function readHeadersJson(outDir: string | URL): NodeAppHeadersJson | undefined {
	let headersMap: NodeAppHeadersJson | undefined = undefined;

	const headersUrl = new URL(STATIC_HEADERS_FILE, outDir);
	if (existsSync(headersUrl)) {
		const content = readFileSync(headersUrl, 'utf-8');
		try {
			headersMap = JSON.parse(content) as NodeAppHeadersJson;
		} catch (e: any) {
			console.error('[@astrojs/node] Error parsing _headers.json: ' + e.message);
			console.error('[@astrojs/node] Please make sure your _headers.json is valid JSON.');
		}
	}
	return headersMap;
}

Domain

Subdomains

Frequently Asked Questions

What does readHeadersJson() do?
readHeadersJson() is a function in the astro codebase, defined in packages/integrations/node/src/server.ts.
Where is readHeadersJson() defined?
readHeadersJson() is defined in packages/integrations/node/src/server.ts at line 50.
What calls readHeadersJson()?
readHeadersJson() is called by 2 function(s): createExports, start.

Analyze Your Own Codebase

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

Try Supermodel Free