Skip to content
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

Returning a res object #69

Closed
awwright opened this issue Sep 18, 2020 · 2 comments
Closed

Returning a res object #69

awwright opened this issue Sep 18, 2020 · 2 comments

Comments

@awwright
Copy link

This is related to a comment I left on a gist that was posted somewhere here; I'm interested in the ability to return a ServerResponse object, instead of using a created one. I have a library, http-transform, that allows you to do this (more-or-less, see below).

An upside to this is it lets you use pipe(), a downside is you don't know the capabilities of the receiving end (if it's HTTP/1.1, HTTP/2, etc). However, that responses use completely generic HTTP semantics instead of encoding-specific semantics could itself be seen as an upshot in some cases.

This is likely a poor way to do all Node.js HTTP responses, but it seems to me a framework should be able to do things this way.

I'm looking to discuss some of the limitations of Node.js that make this difficult, like in the http and stream modules. Is this a good topic for discussion?

@wesleytodd
Copy link
Member

Have you seen the work here? #60

Would love yo have you on these conversations if you have input, and I think we are all looking at this same pattern as a good way forward. To consolidate the conversation, lets move this over to that issue to continue the conversation.

@awwright
Copy link
Author

@wesleytodd I don't think that's really the same thing; I'm not proposing a change in the public API except maybe for how streams works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants