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
  e3571136_c454_d540_1f1d_c4c7f141acbc["GET()"]
  d61aef29_8496_bca0_a5c3_5be884afe140["api.ts"]
  e3571136_c454_d540_1f1d_c4c7f141acbc -->|defined in| d61aef29_8496_bca0_a5c3_5be884afe140
  style e3571136_c454_d540_1f1d_c4c7f141acbc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/test/fixtures/sessions/src/pages/api.ts lines 3–13

export const GET: APIRoute = async (context) => {
	const url = new URL(context.url, 'http://localhost');
	let value = url.searchParams.get('set');
	if (value) {
		 context.session.set('value', value);
	} else {
		value = await context.session.get('value');
	}
	const cart = await context.session.get('cart');
	return Response.json({ value, cart });
};

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free