-
-
Notifications
You must be signed in to change notification settings - Fork 124
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 middleware and custom routes #513
Comments
my wishlist for the middleware & server context:
Use Cases:
|
Thanks for the feedback!
Yes, I have that requirement in my head. Haven't decided how to configure them.
Yes, I have that too.
Yes but only the context (you need your own middleware to interact with request and response. we probably provide cookie middleware by default.), with a limitation that the context is locked after starting the stream (not different from now). |
One correction: Now, as we try to hide Hono for user-facing api, I'm not sure if we can expose the request and response objects, maybe only headers. |
as long as I can use a middleware to grab some values from the request and add it as a new property to the context this should be no problem. Maybe there is a way for a server component to register a middleware? But I would not look at this without a use case. |
what would be such values other than headers, for example? |
In an AWS Lambda environment the handler gets an event object and a lambda context. The lambda object has a method to check for the remaining time before the process gets killed and some other properties (use case: long running server processes - >30 seconds) . Currently I think that accessing the header, the custom context and some helper functions like (e.g. respondWith to handle Errors and Redirects) from a server component should be enough. I looked at hono and h3 - h3 has the most minimalistic api - which could be an inspiration. Cookies helpers should be optional functions with tree shaking support. Access to the body, Method is only relevant, for API endpoints. |
That's a good requirement for designing apis. |
Done with four PRs. Please see rsc-basic fixture to disable SSR middleware (equivalent to no There are no examples for custom routes/api, but hope someone tries it. We won't be working on #329 very soon (or never), and we want feedback with this in the meantime. There are some unfortunate hacks like |
split from #329.
This will be some refactors/re-architect mostly internally.
The text was updated successfully, but these errors were encountered: