Replies: 3 comments 3 replies
-
I've also implemented this using middleware already, and I think it makes sense for the framework to handle it. |
Beta Was this translation helpful? Give feedback.
-
While this is not added to the core framework yet, I am trying to describe this design pattern in the documentation |
Beta Was this translation helpful? Give feedback.
-
Personally, I don't like using a However, when I implemented the middleware during the experimental phase, it was possible to bail by NOT calling Between throwing a response or not calling |
Beta Was this translation helpful? Give feedback.
-
Body
Summary
Bailing out would eliminate the need to pass the response down the chain to the
return
statement.Background & Motivation
Remix:
The below taken from: https://docs.astro.build/en/guides/backend/google-firebase/#creating-pages
If there are many pages that require this check, this gets repetetive. Less code = better code.
Goals
Example
Another example:
Possible middleware implementation:
Beta Was this translation helpful? Give feedback.
All reactions