Home / File/ middleware.ts — astro Source File

middleware.ts — astro Source File

Architecture documentation for middleware.ts, a typescript file in the astro codebase. 1 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  bce5c1a2_6c49_6886_1c38_ab3174ea01f7["middleware.ts"]
  3a7a7ff7_6c64_95f9_af85_4deb518834f1["astro:middleware"]
  bce5c1a2_6c49_6886_1c38_ab3174ea01f7 --> 3a7a7ff7_6c64_95f9_af85_4deb518834f1
  style bce5c1a2_6c49_6886_1c38_ab3174ea01f7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { defineMiddleware } from 'astro:middleware';

export const onRequest = defineMiddleware(({ isPrerendered }, next) => {
	if (!isPrerendered) {
		throw new Error('This middleware should only run in prerendered mode.');
	}
	return next();
});

Subdomains

Functions

Dependencies

  • astro:middleware

Frequently Asked Questions

What does middleware.ts do?
middleware.ts is a source file in the astro codebase, written in typescript. It belongs to the IntegrationAdapters domain, SsrAdapters subdomain.
What functions are defined in middleware.ts?
middleware.ts defines 1 function(s): onRequest.
What does middleware.ts depend on?
middleware.ts imports 1 module(s): astro:middleware.
Where is middleware.ts in the architecture?
middleware.ts is located at packages/astro/test/fixtures/static-redirect/src/middleware.ts (domain: IntegrationAdapters, subdomain: SsrAdapters, directory: packages/astro/test/fixtures/static-redirect/src).

Analyze Your Own Codebase

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

Try Supermodel Free