Home / File/ posts.json.js — astro Source File

posts.json.js — astro Source File

Architecture documentation for posts.json.js, a javascript file in the astro codebase.

Entity Profile

Relationship Graph

Source Code

async function fetchPosts() {
    const files = import.meta.glob('./posts/**/*.md');
    
    const posts = await Promise.all(
        Object.entries(files).map(([filename, load]) => load().then(({ frontmatter }) => {
            return {
                filename,
                title: frontmatter.title,
            };
        })),
    );

    return posts.sort((a, b) => a.title.localeCompare(b.title));
}

export async function GET() {
    const posts = await fetchPosts();
    return Response.json(posts);
}

Subdomains

Functions

Frequently Asked Questions

What does posts.json.js do?
posts.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 posts.json.js?
posts.json.js defines 2 function(s): GET, fetchPosts.
Where is posts.json.js in the architecture?
posts.json.js is located at packages/astro/test/fixtures/static-build/src/pages/posts.json.js (domain: IntegrationAdapters, subdomain: SsrAdapters, directory: packages/astro/test/fixtures/static-build/src/pages).

Analyze Your Own Codebase

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

Try Supermodel Free