add handle: addComment;addPackage storage:ListPackage;AddComment;AddPackage

This commit is contained in:
2023-08-10 12:38:55 +03:00
parent bbb9174d8a
commit 92153397a0
22 changed files with 889 additions and 672 deletions

View File

@@ -12,7 +12,6 @@ import (
"go.unistack.org/unistack-org/pkgdash/storage"
cmsservice "go.unistack.org/cms-service"
grpcsrv "go.unistack.org/micro-server-grpc/v3"
"go.unistack.org/micro/v3"
"go.unistack.org/micro/v3/config"
"go.unistack.org/micro/v3/logger"
@@ -43,12 +42,7 @@ func NewService(ctx context.Context) (micro.Service, error) {
router = microuter.NewRouter()
}
mgsrv := grpcsrv.NewServer(
server.Register(reg),
)
svc := micro.NewService(
micro.Server(mgsrv),
micro.Register(reg),
micro.Router(router),
micro.Config(cs...),
@@ -133,9 +127,10 @@ func NewService(ctx context.Context) (micro.Service, error) {
mux := http.NewServeMux()
mux.HandleFunc("/listPackage", h.ListPackage)
mux.HandleFunc("/updateInfo", h.UpdateInfo)
mux.HandleFunc("/addComment", h.AddComment)
mux.HandleFunc("/listPackage", handler.Methods(http.MethodGet, h.ListPackage))
mux.HandleFunc("/updateInfo", handler.Methods(http.MethodPost, h.UpdateInfo))
mux.HandleFunc("/addComment", handler.Methods(http.MethodPut, h.AddComment))
mux.HandleFunc("/addPackage", handler.Methods(http.MethodPost, h.AddPackage))
if err = svc.Server().Handle(svc.Server().NewHandler(mux)); err != nil {
logger.Fatalf(ctx, "failed to register handler: %v", err)