first() — astro Function Reference
Architecture documentation for the first() function in middleware.js from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 559c0cf9_c355_8a8a_ba51_3248914b80cc["first()"] 8b6db6b2_b07c_0aa4_42ee_c50194d41688["middleware.js"] 559c0cf9_c355_8a8a_ba51_3248914b80cc -->|defined in| 8b6db6b2_b07c_0aa4_42ee_c50194d41688 style 559c0cf9_c355_8a8a_ba51_3248914b80cc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/test/fixtures/middleware-ssg/src/middleware.js lines 3–10
const first = defineMiddleware(async (context, next) => {
if (context.request.url.includes('/second')) {
context.locals.name = 'second';
} else {
context.locals.name = 'bar';
}
return await next();
});
Domain
Subdomains
Source
Frequently Asked Questions
What does first() do?
first() is a function in the astro codebase, defined in packages/astro/test/fixtures/middleware-ssg/src/middleware.js.
Where is first() defined?
first() is defined in packages/astro/test/fixtures/middleware-ssg/src/middleware.js at line 3.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free