|
@@ -26,12 +26,12 @@ import (
|
|
{{.importPackages}}
|
|
{{.importPackages}}
|
|
)
|
|
)
|
|
|
|
|
|
-func RegisterHandlers(engine *ngin.Engine, serverCtx *svc.ServiceContext) {
|
|
|
|
|
|
+func RegisterHandlers(engine *rest.Engine, serverCtx *svc.ServiceContext) {
|
|
{{.routesAdditions}}
|
|
{{.routesAdditions}}
|
|
}
|
|
}
|
|
`
|
|
`
|
|
routesAdditionTemplate = `
|
|
routesAdditionTemplate = `
|
|
- engine.AddRoutes([]ngin.Route{
|
|
|
|
|
|
+ engine.AddRoutes([]rest.Route{
|
|
{{.routes}}
|
|
{{.routes}}
|
|
}{{.jwt}}{{.signature}})
|
|
}{{.jwt}}{{.signature}})
|
|
`
|
|
`
|
|
@@ -80,11 +80,11 @@ func genRoutes(dir string, api *spec.ApiSpec) error {
|
|
}
|
|
}
|
|
jwt := ""
|
|
jwt := ""
|
|
if g.jwtEnabled {
|
|
if g.jwtEnabled {
|
|
- jwt = fmt.Sprintf(", ngin.WithJwt(serverCtx.Config.%s.AccessSecret)", g.authName)
|
|
|
|
|
|
+ jwt = fmt.Sprintf(", rest.WithJwt(serverCtx.Config.%s.AccessSecret)", g.authName)
|
|
}
|
|
}
|
|
signature := ""
|
|
signature := ""
|
|
if g.signatureEnabled {
|
|
if g.signatureEnabled {
|
|
- signature = fmt.Sprintf(", ngin.WithSignature(serverCtx.Config.%s.Signature)", g.authName)
|
|
|
|
|
|
+ signature = fmt.Sprintf(", rest.WithSignature(serverCtx.Config.%s.Signature)", g.authName)
|
|
}
|
|
}
|
|
if err := gt.Execute(&builder, map[string]string{
|
|
if err := gt.Execute(&builder, map[string]string{
|
|
"routes": strings.TrimSpace(gbuilder.String()),
|
|
"routes": strings.TrimSpace(gbuilder.String()),
|
|
@@ -130,7 +130,7 @@ func genRoutes(dir string, api *spec.ApiSpec) error {
|
|
|
|
|
|
func genRouteImports(parentPkg string, api *spec.ApiSpec) string {
|
|
func genRouteImports(parentPkg string, api *spec.ApiSpec) string {
|
|
var importSet = collection.NewSet()
|
|
var importSet = collection.NewSet()
|
|
- importSet.AddStr(`"zero/ngin"`)
|
|
|
|
|
|
+ importSet.AddStr(`"zero/rest"`)
|
|
importSet.AddStr(fmt.Sprintf("\"%s\"", path.Join(parentPkg, contextDir)))
|
|
importSet.AddStr(fmt.Sprintf("\"%s\"", path.Join(parentPkg, contextDir)))
|
|
for _, group := range api.Service.Groups {
|
|
for _, group := range api.Service.Groups {
|
|
for _, route := range group.Routes {
|
|
for _, route := range group.Routes {
|