An example using Hertz
and thrift-gen-http-swagger
.
-
Defines
HTTP
interfaces usingthrift
IDL -
Generates code using
hz
-
Uses
Gorm
andMySQL
-
Generates
swagger
files andswagger ui
service usingthrift-gen-http-swagger
plugin -
/swagger
providesswagger
files and aswagger ui
server -
/handler.go
contains the basic business logic for updating, adding, deleting, and querying users
This example defines HTTP
interfaces using thrift
IDL. The specific interface definitions can be found in user.thrift.
This example uses hz
to generate code. For more details on how to use hz
, refer to the official hz documentation.
The hz
commands used can be found in the Makefile.
For details on binding and validation, refer to Binding and Validate.
thrift-gen-http-swagger
generates swagger
documentation and swagger ui
service through code generation.
For more information on using the plugin, refer to swagger-generate.
cd bizdemo/hertz_swagger_gen && docker-compose up
cd bizdemo/hertz_swagger_gen
go run .