-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
44 lines (37 loc) · 881 Bytes
/
main.go
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
36
37
38
39
40
41
42
43
44
package main
import (
"log"
"github.com/my/app/server"
"github.com/my/app/server/app"
"github.com/my/app/server/config"
"github.com/my/app/server/gqlclient"
"github.com/my/app/server/httpclient"
"github.com/my/app/server/ioredis"
"github.com/my/app/server/msgbroker"
"github.com/my/app/service"
)
func main() {
env, err := config.LoadEnv()
if err != nil {
log.Fatal(err)
}
db := server.ConnectDB(env)
svc := service.Init(db)
api := httpclient.Init(env)
gql := gqlclient.Init(env)
client := ioredis.Init(env)
broker := msgbroker.Init(env)
s := &app.Server{
Env: env,
Database: db,
Client: client,
Service: svc,
HTTPClient: api,
GQLClient: gql,
MSGBroker: broker,
}
go ioredis.InitRedisExpiryPubSub(s)
r := server.InitServer(s)
log.Printf("🚀 Server ready at http://localhost:%s/", env.Port)
r.Run(":" + env.Port)
}