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

[lang].json.js — astro Source File

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

import { getEntry } from 'astro:content';

const langs = ['en', 'es', 'fr'];

export function getStaticPaths() {
	return langs.map((lang) => ({ params: { lang } }));
}

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

Subdomains

Dependencies

  • astro:content

Frequently Asked Questions

What does [lang].json.js do?
[lang].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 [lang].json.js?
[lang].json.js defines 2 function(s): GET, getStaticPaths.
What does [lang].json.js depend on?
[lang].json.js imports 1 module(s): astro:content.
Where is [lang].json.js in the architecture?
[lang].json.js is located at packages/astro/test/fixtures/data-collections-schema/src/pages/translations/[lang].json.js (domain: IntegrationAdapters, subdomain: SsrAdapters, directory: packages/astro/test/fixtures/data-collections-schema/src/pages/translations).

Analyze Your Own Codebase

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

Try Supermodel Free