cloudwego/hertz

Proposal: add compatibility guide for packages built for net/http

Closed this issue · 1 comments

Haswf commented

Is your feature request related to a problem? Please describe.

Compatibility with existing libarays and tools in the web ecosystem is a key factor for mass adoption of Hertz. Yet, Hertz uses a very different design and API, e.g. *http.Request vs *protocol.Request, which made it very challenging to integrate with other library people already femiliar with. As of today, there are 314,984 code snippets uses *http.Handler somewhere.

For instance, the following library/package uses http.Handler interface to register handler.

Describe the solution you'd like

I think it would be worth a paragraph or two to describe how to use tools that built for net/http package in offical documentation. I understand Hertz provides adaptors to get *protocol.Request from *http.Request and http.ResponseWrite from *protocol.Response, but this is not mentioned anywhere in the documentation.
It would also be helpful to address common concerns like performance loss.

Describe alternatives you've considered

As an alternative, we can provide a fews examples on how to integrate Hertz with existing tools. This will make people feel comfortable migrating from existing stack to Hertz.

Additional context

The community has asked a similar question #119 , we should address these type of question in doc once and for all.

Good point! The job is right in the TODOs, if you are interested in it. Any pr is welcome~