-
Notifications
You must be signed in to change notification settings - Fork 36
Integration hooks for middleware #709
Copy link
Copy link
Closed
Description
- Accepted Date: 2023-09-19
- Reference Issues/Discussions: Integration hooks for middleware #692
- Author: @matthewp
- Champion(s): @matthewp
- Implementation PR:
Summary
A brief, one or two sentence explanation of the proposal.
Add an API to integrations which allows them to define middleware so that users do not need to go through the boilerplate of creating a middleware file and importing the functionality.
Background & Motivation
When we built the middleware API we anticipated a need for integrations to hook into it, but we decided not to make that a goal for v1 due to the complexity of ordering. Yet the need keeps coming up for the same reasons as before, integrations want to transparently add middleware.
Goals
- The ability to get middleware into an Astro project simply by adding an integration as normal.
- Allow an integration to place itself either at the front or end of the stack in terms of ordering.
Non-Goals
- Not aiming for full control over middleware ordering at this stage. Middleware ordering is determined dynamically as the root middleware module is defined, so an API that allowed integration control over that would be difficult and more broad than in this proposal. There is no known use-case for this regardless.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Implemented