34 lines
800 B
Go
34 lines
800 B
Go
package server
|
|
|
|
import (
|
|
logging "git.loafle.net/commons/logging-go"
|
|
crpj "git.loafle.net/commons/rpc-go/protocol/json"
|
|
crr "git.loafle.net/commons/rpc-go/registry"
|
|
cswf "git.loafle.net/commons/server-go/web/fasthttp"
|
|
"git.loafle.net/overflow/member_gateway_rest/service"
|
|
"git.loafle.net/overflow/member_gateway_rest/servlet"
|
|
)
|
|
|
|
func NewServer() *cswf.Server {
|
|
serverCodec := crpj.NewServerCodec()
|
|
rpcRegistry := crr.NewRPCRegistry()
|
|
|
|
ms := &service.MemberService{}
|
|
if err := rpcRegistry.RegisterService(ms, ""); nil != err {
|
|
logging.Logger().Error(err)
|
|
}
|
|
|
|
webappS := &servlet.WebappServlet{}
|
|
webappS.ServerCodec = serverCodec
|
|
webappS.RPCInvoker = rpcRegistry
|
|
|
|
sh := &ServerHandlers{}
|
|
sh.RegisterServlet("/webapp", webappS)
|
|
|
|
s := &cswf.Server{
|
|
ServerHandler: sh,
|
|
}
|
|
|
|
return s
|
|
}
|