Home / Function/ GET() — astro Function Reference

GET() — astro Function Reference

Architecture documentation for the GET() function in api.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  7740e5e5_43a3_6fd5_9881_588325a81552["GET()"]
  0988fb33_77b9_081c_12c9_b9c21cef041c["api.ts"]
  7740e5e5_43a3_6fd5_9881_588325a81552 -->|defined in| 0988fb33_77b9_081c_12c9_b9c21cef041c
  style 7740e5e5_43a3_6fd5_9881_588325a81552 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/test/fixtures/live-loaders/src/pages/api.ts lines 6–23

export const GET: APIRoute = async ({ url }) => {
	const addToAge = url.searchParams.get('addToAge');
	const returnInvalid = url.searchParams.has('returnInvalid');
	const filter = addToAge ? { addToAge: parseInt(addToAge), returnInvalid } : undefined;
	const { error, entries, cacheHint } = await getLiveCollection('liveStuff', filter);
	const entryByString = await getLiveEntry('liveStuff', '123');
	const entryByObject = await getLiveEntry('liveStuff', { id: '456', ...filter });

	return Response.json({
		collection: {
			cacheHint,
			entries,
			error: error ? { ...error, message: error.message } : undefined,
		},
		entryByObject,
		entryByString,
	});
};

Subdomains

Frequently Asked Questions

What does GET() do?
GET() is a function in the astro codebase, defined in packages/astro/test/fixtures/live-loaders/src/pages/api.ts.
Where is GET() defined?
GET() is defined in packages/astro/test/fixtures/live-loaders/src/pages/api.ts at line 6.

Analyze Your Own Codebase

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

Try Supermodel Free