usage
Simple Example
Take hz
tool generated project for example:
generations please refer to hz usage(thrift)
Project Structure:
The file containing the route registration code is as follows:
- router.go
// Code generated by hertz generator.
package main
import (
handler "example.com/m/biz/handler"
"github.com/cloudwego/hertz/pkg/app/server"
)
// customizeRegister registers customize routers.
func customizedRegister(r *server.Hertz) {
r.GET("/ping", handler.Ping)
// your code ...
}
- biz/router/hello/example/hello.go
// Code generated by hertz generator. DO NOT EDIT.
package example
import (
example "example.com/m/biz/handler/hello/example"
"github.com/cloudwego/hertz/pkg/app/server"
)
/*
This file will register all the routes of the services in the master idl.
And it will update automatically when you use the "update" command for the idl.
So don't modify the contents of the file, or your code will be deleted when it is updated.
*/
// Register register routes based on the IDL 'api.${HTTP Method}' annotation.
func Register(r *server.Hertz) {
root := r.Group("/", rootMw()...)
root.GET("/hello", append(_hellomethodMw(), example.HelloMethod)...)
}
Now execute the api-list
command in the project root directory
cwgo api-list
or cwgo api-list --project_path .
The output is as follows:
Last modified
September 23, 2024
: Revert "chore: add 9.21 beijing meetup to zh homepage" (#1152) (5e9509f)