Home / Function/ second() — astro Function Reference

second() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  96586d62_8813_2aac_c41e_f7d010eb42c6["second()"]
  66a5ef02_454b_899e_f367_20548926b8ee["middleware.js"]
  96586d62_8813_2aac_c41e_f7d010eb42c6 -->|defined in| 66a5ef02_454b_899e_f367_20548926b8ee
  style 96586d62_8813_2aac_c41e_f7d010eb42c6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/test/fixtures/reroute/src/middleware.js lines 13–32

export const second = async (context, next) => {
	if (context.url.pathname.includes('/auth')) {
		if (context.url.pathname.includes('/auth/dashboard')) {
			contextReroute = true;
			return await context.rewrite('/');
		}
		if (context.url.pathname.includes('/auth/base')) {
			return await next('/');
		}

		if (context.url.pathname.includes('/auth/params')) {
			return  next('/?foo=bar');
		}

		if (context.url.pathname.includes('/auth/astro-params')) {
			return next('/auth/1234');
		}
	}
	return next();
};

Subdomains

Frequently Asked Questions

What does second() do?
second() is a function in the astro codebase, defined in packages/astro/test/fixtures/reroute/src/middleware.js.
Where is second() defined?
second() is defined in packages/astro/test/fixtures/reroute/src/middleware.js at line 13.

Analyze Your Own Codebase

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

Try Supermodel Free