Skip to content
🎉 httpz v1.1.0 released
DocsIntroduction

Why Develop httpz

The net/http version 1.22 has enhanced routing capabilities, allowing us to develop a complete web project without third-party routers (frameworks) like Echo, gin, and chi. However, the standard library’s pursuit of simplicity makes its user experience less convenient than third-party frameworks.

For example:

  1. Grouping is inconvenient. net/http uses the Handle(pattern, http.Handler) function to forward requests of the same group to http.Handler, which is not easy to manage. In contrast, the Echo framework directly uses Group(pattern) to achieve this.

  2. Centralized error handling in Echo is a good practice. We should return errors in the handler, which can reduce the workload of error handling.

  3. Data binding needs to be implemented manually. When a handler needs to bind many request parameters, net/http requires you to bind them one by one.

  4. When returning a response, net/http requires you to manually set the response headers, status code, and response body, which can lead to repetitive code.

What is httpz

httpz is a collection of the following features:

  • Based on net/http version 1.22+
  • Global error handling
  • Convenient grouping
  • Middleware from chi
  • Data binding from Echo
  • Quick response returns

httpz is merely an enhancement library for net/http, not a new framework. Using httpz is essentially developing with the net/http standard library.

httpz is fully compatible with net/http, allowing you to choose to use httpz’s enhanced features or directly use net/http.

Design Philosophy

  • Zero dependencies, all features are implemented based on the net/http API.
  • Convenient and non-intrusive. You can still develop using the net/http conventions.
  • It is an enhancement library, not a new framework.