This commit is contained in:
parent
70e1f4c6bc
commit
a26ed82119
14
cmd/main.go
14
cmd/main.go
@ -12,6 +12,8 @@ import (
|
|||||||
dw_sdk "gitea.timerzz.com/kedaya_haitao/dw-sdk"
|
dw_sdk "gitea.timerzz.com/kedaya_haitao/dw-sdk"
|
||||||
"gitea.timerzz.com/kedaya_haitao/dw-spider/options"
|
"gitea.timerzz.com/kedaya_haitao/dw-spider/options"
|
||||||
"gitea.timerzz.com/kedaya_haitao/dw-spider/spider"
|
"gitea.timerzz.com/kedaya_haitao/dw-spider/spider"
|
||||||
|
"github.com/gofiber/fiber/v3"
|
||||||
|
"github.com/gofiber/fiber/v3/middleware/cors"
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"gorm.io/gorm/logger"
|
"gorm.io/gorm/logger"
|
||||||
)
|
)
|
||||||
@ -40,5 +42,15 @@ func main() {
|
|||||||
|
|
||||||
client := dw_sdk.NewClient(cfg.Dw)
|
client := dw_sdk.NewClient(cfg.Dw)
|
||||||
ctl := spider.NewController(client, db)
|
ctl := spider.NewController(client, db)
|
||||||
ctl.Run(ctx)
|
go ctl.Run(ctx)
|
||||||
|
r := fiber.New()
|
||||||
|
r.Use(cors.New())
|
||||||
|
|
||||||
|
r.Get("/health", func(ctx fiber.Ctx) error {
|
||||||
|
return ctx.SendString("ok")
|
||||||
|
})
|
||||||
|
|
||||||
|
if err = r.Listen(":8080"); err != nil {
|
||||||
|
glog.Warningf("server over: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user