Home / File/ [id].json.js — astro Source File

[id].json.js — astro Source File

Architecture documentation for [id].json.js, a javascript file in the astro codebase. 1 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  7283df45_32da_d4df_befb_9095b4af680e["[id].json.js"]
  48f80d01_e646_3924_78f6_a9d836644746["astro:content"]
  7283df45_32da_d4df_befb_9095b4af680e --> 48f80d01_e646_3924_78f6_a9d836644746
  style 7283df45_32da_d4df_befb_9095b4af680e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { getEntry } from 'astro:content';

const ids = ['Ben Holmes', 'Fred K Schott', 'Nate Moore'];

export function getStaticPaths() {
	return ids.map((id) => ({ params: { id } }));
}

/** @param {import('astro').APIContext} params */
export async function GET({ params }) {
	const { id } = params;
	const author = await getEntry('authors', id);
	if (!author) {
		return Response.json({ error: `Author ${id} Not found` });
	} else {
		return Response.json(author);
	}
}

Subdomains

Dependencies

  • astro:content

Frequently Asked Questions

What does [id].json.js do?
[id].json.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain, SsrAdapters subdomain.
What functions are defined in [id].json.js?
[id].json.js defines 2 function(s): GET, getStaticPaths.
What does [id].json.js depend on?
[id].json.js imports 1 module(s): astro:content.
Where is [id].json.js in the architecture?
[id].json.js is located at packages/astro/test/fixtures/data-collections-schema/src/pages/authors/[id].json.js (domain: IntegrationAdapters, subdomain: SsrAdapters, directory: packages/astro/test/fixtures/data-collections-schema/src/pages/authors).

Analyze Your Own Codebase

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

Try Supermodel Free