1
0
mirror of https://github.com/beego/bee.git synced 2024-11-22 15:10:54 +00:00

Merge pull request #83 from tossp/swagger

添加常量Rootinfo和Subapi
This commit is contained in:
astaxie 2014-11-21 13:14:59 +08:00
commit 0f0a217752

View File

@ -45,19 +45,21 @@ import (
"github.com/astaxie/beego/swagger"
)
var rootinfo string = {{.rootinfo}}
var subapi string = {{.subapi}}
var rootapi swagger.ResourceListing
const (
Rootinfo string = {{.rootinfo}}
Subapi string = {{.subapi}}
BasePath string= "{{.version}}"
)
var rootapi swagger.ResourceListing
var apilist map[string]*swagger.ApiDeclaration
func init() {
basepath := "{{.version}}"
err := json.Unmarshal([]byte(rootinfo), &rootapi)
err := json.Unmarshal([]byte(Rootinfo), &rootapi)
if err != nil {
beego.Error(err)
}
err = json.Unmarshal([]byte(subapi), &apilist)
err = json.Unmarshal([]byte(Subapi), &apilist)
if err != nil {
beego.Error(err)
}
@ -67,7 +69,7 @@ func init() {
a.Path = urlReplace(k + a.Path)
v.Apis[i] = a
}
v.BasePath = basepath
v.BasePath = BasePath
beego.GlobalDocApi[strings.Trim(k, "/")] = v
}
}