-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
35 lines (32 loc) · 928 Bytes
/
Copy pathmain.go
File metadata and controls
35 lines (32 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"context"
wf "github.com/chuccp/go-web-frame"
"github.com/chuccp/go-web-frame/component/cors"
"github.com/chuccp/go-web-frame/config"
wflog "github.com/chuccp/go-web-frame/log"
"github.com/chuccp/httpPush/api"
"github.com/chuccp/httpPush/auth"
"github.com/chuccp/httpPush/cluster"
"github.com/chuccp/httpPush/core"
"github.com/chuccp/httpPush/ex"
"github.com/chuccp/httpPush/ws"
"go.uber.org/zap"
)
func main() {
cfg, err := config.LoadConfig("config.yml")
if err != nil {
panic(err)
}
builder := wf.NewBuilder(cfg)
builder.Service(core.NewApp())
builder.Runner(cluster.NewService())
builder.Rest(api.NewController())
builder.Rest(ex.NewController())
builder.Rest(ws.NewController())
builder.Filter(cors.NewCrosFilter())
builder.Filter(auth.NewAuthFilter())
if err := builder.Build().Run(context.Background()); err != nil {
wflog.Fatal("server stopped", zap.Error(err))
}
}