补充API Doc
This commit is contained in:
parent
50d39008de
commit
c315c4747c
@ -1,7 +1,7 @@
|
|||||||
[app]
|
[app]
|
||||||
name = "devcloud"
|
name = "devcloud"
|
||||||
description = "app desc"
|
description = "app desc"
|
||||||
address = "localhost"
|
address = "http://127.0.0.1:8080"
|
||||||
encrypt_key = "defualt app encrypt key"
|
encrypt_key = "defualt app encrypt key"
|
||||||
|
|
||||||
[datasource]
|
[datasource]
|
||||||
@ -11,7 +11,7 @@
|
|||||||
database = "devcloud_go18"
|
database = "devcloud_go18"
|
||||||
username = "root"
|
username = "root"
|
||||||
password = "123456"
|
password = "123456"
|
||||||
auto_migrate = true
|
auto_migrate = false
|
||||||
debug = true
|
debug = true
|
||||||
|
|
||||||
[http]
|
[http]
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
_ "embed"
|
||||||
|
|
||||||
"122.51.31.227/go-course/go18/devcloud/mcenter/apps/token"
|
"122.51.31.227/go-course/go18/devcloud/mcenter/apps/token"
|
||||||
"github.com/infraboard/mcube/v2/ioc"
|
"github.com/infraboard/mcube/v2/ioc"
|
||||||
"github.com/infraboard/mcube/v2/ioc/config/gorestful"
|
"github.com/infraboard/mcube/v2/ioc/config/gorestful"
|
||||||
@ -23,6 +25,9 @@ func (h *TokenRestulApiHandler) Name() string {
|
|||||||
return token.APP_NAME
|
return token.APP_NAME
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//go:embed docs/login.md
|
||||||
|
var loginApiDocNotes string
|
||||||
|
|
||||||
func (h *TokenRestulApiHandler) Init() error {
|
func (h *TokenRestulApiHandler) Init() error {
|
||||||
h.svc = token.GetService()
|
h.svc = token.GetService()
|
||||||
|
|
||||||
@ -30,6 +35,7 @@ func (h *TokenRestulApiHandler) Init() error {
|
|||||||
ws := gorestful.ObjectRouter(h)
|
ws := gorestful.ObjectRouter(h)
|
||||||
ws.Route(ws.POST("").To(h.Login).
|
ws.Route(ws.POST("").To(h.Login).
|
||||||
Doc("颁发令牌(登录)").
|
Doc("颁发令牌(登录)").
|
||||||
|
Notes(loginApiDocNotes).
|
||||||
Metadata(restfulspec.KeyOpenAPITags, tags).
|
Metadata(restfulspec.KeyOpenAPITags, tags).
|
||||||
Reads(token.IssueTokenRequest{}).
|
Reads(token.IssueTokenRequest{}).
|
||||||
Writes(token.Token{}).
|
Writes(token.Token{}).
|
||||||
|
8
devcloud/mcenter/apps/token/api/docs/login.md
Normal file
8
devcloud/mcenter/apps/token/api/docs/login.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
登录接口
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"username": "admin",
|
||||||
|
"password": "123456"
|
||||||
|
}
|
||||||
|
```
|
18
devcloud/mcenter/main.go
Normal file
18
devcloud/mcenter/main.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/infraboard/mcube/v2/ioc/server/cmd"
|
||||||
|
|
||||||
|
// 加载的业务对象
|
||||||
|
_ "122.51.31.227/go-course/go18/devcloud/mcenter/apps"
|
||||||
|
|
||||||
|
// 非功能性模块
|
||||||
|
_ "github.com/infraboard/mcube/v2/ioc/apps/apidoc/restful"
|
||||||
|
_ "github.com/infraboard/mcube/v2/ioc/apps/health/restful"
|
||||||
|
_ "github.com/infraboard/mcube/v2/ioc/apps/metric/restful"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// 启动
|
||||||
|
cmd.Start()
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user