Home / File/ api.ts — astro Source File

api.ts — astro Source File

Architecture documentation for api.ts, a typescript file in the astro codebase. 2 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  0988fb33_77b9_081c_12c9_b9c21cef041c["api.ts"]
  f16d8c76_2866_6150_bd14_0347b59abfe9["astro"]
  0988fb33_77b9_081c_12c9_b9c21cef041c --> f16d8c76_2866_6150_bd14_0347b59abfe9
  48f80d01_e646_3924_78f6_a9d836644746["astro:content"]
  0988fb33_77b9_081c_12c9_b9c21cef041c --> 48f80d01_e646_3924_78f6_a9d836644746
  style 0988fb33_77b9_081c_12c9_b9c21cef041c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { APIRoute } from 'astro';
import { getLiveCollection, getLiveEntry } from 'astro:content';

export const prerender = false;

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

Functions

Dependencies

  • astro
  • astro:content

Frequently Asked Questions

What does api.ts do?
api.ts is a source file in the astro codebase, written in typescript. It belongs to the IntegrationAdapters domain, SsrAdapters subdomain.
What functions are defined in api.ts?
api.ts defines 1 function(s): GET.
What does api.ts depend on?
api.ts imports 2 module(s): astro, astro:content.
Where is api.ts in the architecture?
api.ts is located at packages/astro/test/fixtures/live-loaders/src/pages/api.ts (domain: IntegrationAdapters, subdomain: SsrAdapters, directory: packages/astro/test/fixtures/live-loaders/src/pages).

Analyze Your Own Codebase

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

Try Supermodel Free