diff --git a/pkg/loafer/app/app.go b/pkg/loafer/app/app.go index 1a1e6f0..791371f 100644 --- a/pkg/loafer/app/app.go +++ b/pkg/loafer/app/app.go @@ -6,16 +6,34 @@ import ( cdr "git.loafle.net/commons/di-go/registry" - annotation "git.loafle.net/totopia/server/pkg/loafer/app/annotation" + appAnnotation "git.loafle.net/totopia/server/pkg/loafer/app/annotation" + webAnnotation "git.loafle.net/totopia/server/pkg/loafer/web/annotation" ) func Run(t reflect.Type) { - ta := cdr.GetTypeAnnotation(t, annotation.ServerAnnotationType) - if nil == ta { + taServer := cdr.GetTypeAnnotation(t, appAnnotation.ServerAnnotationType) + if nil == taServer { log.Printf("[%s] is not Server, use @app:Server", t.Elem().Name()) return } - vta := ta.(*annotation.ServerAnnotation) - log.Printf("%s %d", t.Elem().Name(), vta.HTTPPort) + aServer := taServer.(*appAnnotation.ServerAnnotation) + log.Printf("%s %d", t.Elem().Name(), aServer.HTTPPort) + + restHandlers, err := cdr.GetInstancesByAnnotationType(webAnnotation.RestHandlerAnnotationType) + if nil != err { + log.Printf("[%v]", err) + return + } + + for _, restHandler := range restHandlers { + t := reflect.TypeOf(restHandler) + ta := cdr.GetTypeAnnotation(t, webAnnotation.RestHandlerAnnotationType) + if nil == ta { + log.Printf("Service[%s] is not RESTService, use @RESTService", t.Elem().Name()) + continue + } + log.Printf("%s %v", t.Elem().Name(), ta) + + } } diff --git a/pkg/server/server.go b/pkg/server/server.go index 83924d8..e2d72f4 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -8,6 +8,9 @@ import ( // For annotation _ "git.loafle.net/totopia/server/pkg/loafer/app/annotation" + + // For user + _ "git.loafle.net/totopia/server/pkg/modules/user" ) var ServerType = reflect.TypeOf((*Server)(nil))