增加社区列表接口,任务相关接口修改
This commit is contained in:
19
novatask.go
19
novatask.go
@@ -3,9 +3,11 @@ package main
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/service"
|
||||
"nova_task/internal/config"
|
||||
"nova_task/internal/handler"
|
||||
"nova_task/internal/job"
|
||||
"nova_task/internal/pkg/errs"
|
||||
"nova_task/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
@@ -21,14 +23,19 @@ func main() {
|
||||
conf.MustLoad(*configFile, &c)
|
||||
c.MustSetUp()
|
||||
|
||||
server := rest.MustNewServer(c.RestConf)
|
||||
defer server.Stop()
|
||||
|
||||
ctx := svc.NewServiceContext(c)
|
||||
defer ctx.Close()
|
||||
|
||||
handler.RegisterHandlers(server, ctx)
|
||||
serviceGroup := service.NewServiceGroup()
|
||||
defer serviceGroup.Stop()
|
||||
|
||||
jb := job.NewJob(ctx)
|
||||
serviceGroup.Add(jb)
|
||||
|
||||
httpSvr := rest.MustNewServer(c.RestConf, rest.WithCors(), errs.WithUnauthorizedCallback())
|
||||
handler.RegisterHandlers(httpSvr, ctx)
|
||||
serviceGroup.Add(httpSvr)
|
||||
|
||||
fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
|
||||
server.Start()
|
||||
serviceGroup.Start()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user