-
Notifications
You must be signed in to change notification settings - Fork 19
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
Support Express-like frameworks #67
Comments
Typically you would wrap the middleware and then pass in what it needs, but I can see how the TypeScript type declarations would get in the way of that. Because you aren't using express, yet suddenly you have to pass in an express based Request. I'll try setting up my own small tinyhttp TS project and see what I can do. I suspect this can be resolved by allowing for a generic type which defaults to the express Request one, unioned with the bare minimum properties expected on the The one concern there is the I could go the way of |
As a stop-gap measure I set up otterjs/csrf-csrf - thankyou for looking into this :) |
Ah yep. Thinking on this, it might definitely be best to set the cookie using methods that don't depend on a framework specific dependency similar to how Making the types less express specific would definitely be handy too. |
One strategy I've been using to make request/response types less framework specific can be seen here: https://github.com/OtterJS/otterhttp/blob/main/packages/response/src/types.ts The request type 'snippets' can be composed as needed - e.g. one function only requires That example |
E.g. tinyhttp. The main issue is the use of Express-specific type declarations for
Request
,Response
.The text was updated successfully, but these errors were encountered: