Example code
Server
Run hertz
- hello :Example of launching a hertz “hello world” application
Config
- config :Example of configuring hertz server
Protocol
- Protocol :Example of hertz using protocols such as http1, tls, etc
Route
- Route :Examples of registering routes, using route groups, and parameter routes
Middleware
- CORS :Example of using the CORS middleware
- basic_auth :Example of using basic auth middleware
- custom :Example of custom middleware
Parameter binding and validation
- binding :Example of parameter binding and validation
Get Parameters
- parameters :Example of getting query, form, cookie, etc. parameters
Documents
- file :Examples of file upload, file download, and static file services
Render
- render :Example of render body as json, html, protobuf, etc
Redirect
- redirect :Example of a redirect to an internal/external URI
Streaming read/write
- streaming :Example of streaming read/write using hertz server
Graceful shutdown
Unit test
- unit_test :Example of writing unit tests using the interface provided by hertz without network transmission
Tracing
- tracer :Example of hertz using Jaeger for link tracing
Monitoring
- monitoring :hertz Example of metrics monitoring with Prometheus
Client
Send request
- send_request :Example of sending an http request using the hertz client
Client config
TLS
- tls :Example of hertz client sending a tls request
Add parameters
- add_parameters :Example of adding request parameters using the hertz client
Upload file
- upload_file :Example of uploading a file using the hertz client
Middleware
- middleware :Example of using the hertz client middleware
Streaming read
- streaming_read :Example of a streaming read response using the hertz client
Forward proxy
- forward_proxy :Example of configuring a forward proxy using the hertz client