go-zero
go-zero copied to clipboard
When using the 'goctl api go' command, an error is reported: missing input
When I finished editing the API file and layered it according to the directory, I finally imported other API files into a main API file through API import.
Here is my directory structure
login.api
type (
LoginRequest {
Mobile string `json:"mobile"`
Password string `json:"password"`
}
LoginResponse {
AccessToken string `json:"accessToken"`
AccessExpire int64 `json:"accessExpire"`
}
)
register.api
type (
RegisterRequest {
Name string `json:"name"`
Gender int64 `json:"gender"`
Mobile string `json:"mobile"`
Password string `json:"password"`
}
RegisterResponse {
Id int64 `json:"id"`
Name string `json:"name"`
Gender int64 `json:"gender"`
Mobile string `json:"mobile"`
}
)
userinfo.api
type (
UserInfoResponse {
Id int64 `json:"id"`
Name string `json:"name"`
Gender int64 `json:"gender"`
Mobile string `json:"mobile"`
}
)
user.api
import (
"login/login.api"
"register/register.api"
"userinfo/useinfo.api"
)
@server (
prefix: /user/v1
)
service user-api {
@handler Login
post /api/login (LoginRequest) returns (LoginResponse)
@handler Register
post /api/register (RegisterRequest) returns (RegisterResponse)
}
@server (
prefix: /user/v1
jwt: Auth
)
service user-api {
@handler UserInfo
post /api/userinfo returns (UserInfoResponse)
}