Home / Function/ onRequest() — astro Function Reference

onRequest() — astro Function Reference

Architecture documentation for the onRequest() function in middleware.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  65ec6a60_aae6_ce32_16a2_faaf11dfcaca["onRequest()"]
  0dd768b5_85c3_f808_5090_743124bf76df["middleware.ts"]
  65ec6a60_aae6_ce32_16a2_faaf11dfcaca -->|defined in| 0dd768b5_85c3_f808_5090_743124bf76df
  style 65ec6a60_aae6_ce32_16a2_faaf11dfcaca fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/netlify/test/hosted/hosted-astro-project/src/middleware.ts lines 3–11

export const onRequest = (context, next) => {
	console.info(context.netlify);
	context.locals.middleware = context?.locals?.netlify?.context?.geo?.country?.code ?? null;
	context.locals.runtime = 'Deno' in globalThis ? 'Deno' : 'Node';
	context.locals.title = 'Middleware';
	context.locals.nodePrefixedImportExists = !!https;

	return next();
};

Domain

Subdomains

Frequently Asked Questions

What does onRequest() do?
onRequest() is a function in the astro codebase, defined in packages/integrations/netlify/test/hosted/hosted-astro-project/src/middleware.ts.
Where is onRequest() defined?
onRequest() is defined in packages/integrations/netlify/test/hosted/hosted-astro-project/src/middleware.ts at line 3.

Analyze Your Own Codebase

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

Try Supermodel Free