#Middleware type pattern?
10 messages · Page 1 of 1 (latest)
yes, when using node adapter and others I think, here the doc https://docs.astro.build/en/guides/integrations-guide/node/#middleware
yeah I'm trying to see if there's something that's not adapter specific
because something adapter specific won't run in local dev mode
That contradicts the idea of the middleware being a collaboration with an external program when Astro is just a middleware.
So what do you want ? To have everything run within Astro => go for Standalone, you want a middleware => you cannot use the external program (e.g. nodejs, or other adapter) in dev mode, although who knows maybe someone could make an adapter work in dev mode, that would be a feature request section.
dev mode was not intended to be the equals of the prod, by limiting your scope to what the dev only can do you will not be use the production modes.
dev mode was not intended to be the equals of the prod
The more dissimilar they are, the harder it is to have confidence in your code before deploying it. There are always going to be incompatibilities, but I do think the framework should strive to keep things as compatible as possible across environments.
I totally agree with you there. My hope is with deno and the stop of dev ssr bundling, it played me bad tricks where pure js concepts no longer work with bundling. Things like debug should be a priority, but well Vite decided otherwise, it achieved quick build and quick dev but ruined the dev prod unicity. I prefer to forget about dev in that case, and just work like in C (build, test cycle) rather than fallback on a hacky unreliable dev mode. You have no idea how many issues were filed for dev prod divergence, if that is DX improvement, I'm out 😉
My advice, make prod your dev rather than the other way around.
the thing is if I need to run something at the beginning of every request I don't really see why that needs to be tied to the adapter