Home / Function/ GET() — astro Function Reference

GET() — astro Function Reference

Architecture documentation for the GET() function in welcome-data.json.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  415eebef_b4eb_c90c_8919_abbc161f4d9f["GET()"]
  e31bf905_f675_86db_15a1_b0e751aa8219["welcome-data.json.js"]
  415eebef_b4eb_c90c_8919_abbc161f4d9f -->|defined in| e31bf905_f675_86db_15a1_b0e751aa8219
  style 415eebef_b4eb_c90c_8919_abbc161f4d9f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/test/fixtures/content-collection-references/src/pages/welcome-data.json.js lines 3–20

export async function GET() {
	const welcomePost = await getEntry('blog', 'welcome');

	if (!welcomePost?.data) {
		return Response.json({ error: 'blog/welcome did not return `data`.' }, { status: 404 })
	}

	const banner = await getEntry(welcomePost.data.banner);
	const author = await getEntry(welcomePost.data.author);
	const relatedPosts = await getEntries(welcomePost.data.relatedPosts ?? []);

	return Response.json({
		welcomePost,
		banner,
		author,
		relatedPosts,
	})
}

Subdomains

Frequently Asked Questions

What does GET() do?
GET() is a function in the astro codebase, defined in packages/astro/test/fixtures/content-collection-references/src/pages/welcome-data.json.js.
Where is GET() defined?
GET() is defined in packages/astro/test/fixtures/content-collection-references/src/pages/welcome-data.json.js at line 3.

Analyze Your Own Codebase

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

Try Supermodel Free