Home / Function/ first() — astro Function Reference

first() — astro Function Reference

Architecture documentation for the first() function in middleware.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  b184c309_4b27_1041_5801_394d349bba32["first()"]
  0d2161c8_9cdf_64eb_c8ca_7aa4e135c503["middleware.js"]
  b184c309_4b27_1041_5801_394d349bba32 -->|defined in| 0d2161c8_9cdf_64eb_c8ca_7aa4e135c503
  style b184c309_4b27_1041_5801_394d349bba32 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/test/fixtures/rewrite-route-pattern/src/middleware.js lines 3–10

export const first = defineMiddleware(async (context, next)=> {
	if (context.url.pathname === '/index2') {
		return next('/123/post')
	} else {
		
		return next(`/destination`);
	}
});

Subdomains

Frequently Asked Questions

What does first() do?
first() is a function in the astro codebase, defined in packages/astro/test/fixtures/rewrite-route-pattern/src/middleware.js.
Where is first() defined?
first() is defined in packages/astro/test/fixtures/rewrite-route-pattern/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