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
  91ec96ea_8b1f_a8c3_fdb1_ee96407ff826["onRequest()"]
  c21530e8_72fc_ecc8_0a41_2076a4ae2cca["middleware.ts"]
  91ec96ea_8b1f_a8c3_fdb1_ee96407ff826 -->|defined in| c21530e8_72fc_ecc8_0a41_2076a4ae2cca
  style 91ec96ea_8b1f_a8c3_fdb1_ee96407ff826 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/node/test/fixtures/locals/src/middleware.ts lines 3–6

export const onRequest = defineMiddleware(({ url, locals }, next) => {
    if (url.pathname === "/from-astro-middleware") locals.foo = "baz";
    return next();
})

Domain

Subdomains

Frequently Asked Questions

What does onRequest() do?
onRequest() is a function in the astro codebase, defined in packages/integrations/node/test/fixtures/locals/src/middleware.ts.
Where is onRequest() defined?
onRequest() is defined in packages/integrations/node/test/fixtures/locals/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