info( title: "type title here" desc: "type desc here" author: "type author here" email: "type email here" version: "type version here" ) type ( RegisterReq { Username string `json:"username"` Password string `json:"password"` Mobile string `json:"mobile"` } // 登录请求 LoginReq { // 用户名 Username string `json:"username" desc:"用户名"` Password string `json:"password"` //密码 } // 登录请求 UserInfoReq { Id string `path:"id"` } UserInfoReply { Name string `json:"name"` Age int `json:"age"` Birthday string `json:"birthday"` Description string `json:"description"` Tag []string `json:"tag"` } UserSearchReq { KeyWord string `form:"keyWord"` } UserSearchReply { KeyWord []UserInfoReply } ) service user-api { @doc( summary: "注册" description: "注册一个用户" ) @handler register post /api/user/register (RegisterReq) @doc( summary: "登录" ) @handler login post /api/user/login (LoginReq) @doc( summary: "获取用户信息" ) @handler getUserInfo get /api/user/:id (UserInfoReq) returns (UserInfoReply) @doc( summary: "用户搜索" ) @handler searchUser get /api/user/search (UserSearchReq) returns (UserSearchReply) } @server( jwt: Auth group: greet middleware: LogHandler ) service user-api { @handler ping get /user/ping }