-
Notifications
You must be signed in to change notification settings - Fork 405
refactor middleware #2047
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
refactor middleware #2047
Conversation
🦋 Changeset detectedLatest commit: c575fda The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for solid-start-landing-page ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
commit: |
|
Imho the deprecation warnings should stay 🤔. Afaik the end goal is that users ideally will just use h3 middleware and we only keep |
but how do they use h3 middleware? |
|
tip for users, when you do this: export default createMiddleware({
onBeforeResponse: async (e, r) => {
console.log(await r.text());
},
});and you're streaming, your stream will be deferred. export default createMiddleware({
onBeforeResponse: (e, r) => {
e.nativeEvent.waitUntil((async () => {
console.log(await r.text());
})());
},
}); |
|
it seems this crashes with |
… optional & rename onRequestFn back to onRequest
To be honest, we still are debating it 😅. My plan is to write an RFC with a new API that will look somewhat like this: In short: the user get's to create the P.S. @ryansolid's long term goal/idea is, to basically make Start completely server-framework independent, so Start would just return a handler that can be integrated into any WinterCG compatible framework. We have to keep that in mind when thinking about middleware related API's. |
h3 v2 already exposes the app in |
i deleted some stuff like deprecation warnings please tell me if they should stay
currently in v2 when you do:
response.bodyis undefinedthat is fixed
also, there's a new breaking change (relative to start v1): response is now
Responseinstead of{ body: ReadableStream | string }(ReadableStreamifmodeis"stream",stringotherwise)