-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Astro Middleware documentation #3069
Copy link
Copy link
Closed
Labels
add new contentDocument something that is not in docs. May require testing, confirmation, or affect other pages.Document something that is not in docs. May require testing, confirmation, or affect other pages.
Description
The platform team is about the add a new feature in astro. The feature is called "Astro middleware".
Few useful links:
- RFC Stage 2, here's a relevant comment from @matthewp that highlights possible use cases;
- RFC Stage 3
- Relevant PR, the description of the PR has instructions of how to install the preview release;
A middleware unlocks two major things:
- do various operations based on the
RequestandResponse, and also modify theResponsebefore being rendered; a user can also return a newResponse; - store contextual information inside a new global called
Astro.locals/context.locals(they're the same object), and then render something based on thisAstro.locals;
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
add new contentDocument something that is not in docs. May require testing, confirmation, or affect other pages.Document something that is not in docs. May require testing, confirmation, or affect other pages.