package server import ( cdr "git.loafle.net/commons/di-go/registry" "git.loafle.net/commons/logging-go" cswf "git.loafle.net/commons/server-go/web/fasthttp" oca "git.loafle.net/overflow/commons-go/annotation" "git.loafle.net/overflow/member_gateway_rest/config" "git.loafle.net/overflow/member_gateway_rest/servlet" ) func NewServer(_config *config.Config) *cswf.Server { cdr.RegisterResource("VerifyKey", _config.VerifyKey) cdr.RegisterResource("SignKey", _config.SignKey) services, err := cdr.GetInstancesByAnnotationType(oca.RESTServiceAnnotationType) if nil != err { logging.Logger().Panic(err) } webappS := &servlet.WebappServlets{} if err := webappS.RegisterRESTServices(services); nil != err { logging.Logger().Panic(err) } sh := &ServerHandlers{ ServerHandlers: *_config.ServerHandler, Config: _config, } sh.RegisterServlet("/webapp", webappS) s := &cswf.Server{ ServerHandler: sh, } return s }