Home / Function/ GET() — astro Function Reference

GET() — astro Function Reference

Architecture documentation for the GET() function in collections.json.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  422f46d3_cc1c_81eb_492a_a1cf4d5554ea["GET()"]
  a0cb2ce7_594f_657e_9e08_e17c7702e807["collections.json.js"]
  422f46d3_cc1c_81eb_492a_a1cf4d5554ea -->|defined in| a0cb2ce7_594f_657e_9e08_e17c7702e807
  style 422f46d3_cc1c_81eb_492a_a1cf4d5554ea fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/e2e/fixtures/cloudflare/src/pages/collections.json.js lines 4–68

export async function GET() {
	const customLoader = await getCollection('blog', (entry) => {
		return entry.data.id < 6;
	});
	const jsonLoader = await getCollection('dogs');

	const dataEntry = await getEntry('dogs', 'beagle');

	const simpleLoader = await getCollection('cats');

	const entryWithReference = await getEntry('spacecraft', 'columbia-copy');
	const atlantis = await getEntry('spacecraft', 'atlantis');
	const referencedEntry = await getEntry(entryWithReference.data.cat);

	const spacecraft = await getCollection('spacecraft');

	const entryWithImagePath = await getEntry('spacecraft', 'lunar-module');

	const increment = await getEntry('increment', 'value');

	const images = await getCollection('images');

	const simpleLoaderObject = await getCollection('rodents')

	const probes = await getCollection('probes');

	const yamlLoader = await getCollection('fish');

	const tomlLoader = await getCollection('songs');

	const nestedJsonLoader = await getCollection('birds');
	
	const csvLoader = await getCollection('plants');
	
	const numbers = await getCollection('numbers');

	const numbersYaml = await getCollection('numbersYaml');

	const numbersToml = await getCollection('numbersToml');
	
	return new Response(
		devalue.stringify({
			customLoader,
			jsonLoader,
			dataEntry,
			simpleLoader,
			simpleLoaderObject,
			entryWithReference,
			entryWithImagePath,
			referencedEntry,
			increment,
			numbers,
			numbersYaml,
			numbersToml,
			images, 
			probes,
			yamlLoader,
			tomlLoader,
			nestedJsonLoader,
			csvLoader,
			atlantis,
			spacecraft: spacecraft.map(({id}) => id).sort((a, b) => a.localeCompare(b)),
		})
	);
}

Subdomains

Frequently Asked Questions

What does GET() do?
GET() is a function in the astro codebase, defined in packages/astro/e2e/fixtures/cloudflare/src/pages/collections.json.js.
Where is GET() defined?
GET() is defined in packages/astro/e2e/fixtures/cloudflare/src/pages/collections.json.js at line 4.

Analyze Your Own Codebase

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

Try Supermodel Free