forked from goal-web/goal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
70 lines (65 loc) · 1.84 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package main
import (
"github.com/goal-web/application"
"github.com/goal-web/application/signal"
"github.com/goal-web/auth"
"github.com/goal-web/cache"
"github.com/goal-web/config"
"github.com/goal-web/contracts"
"github.com/goal-web/database"
"github.com/goal-web/encryption"
"github.com/goal-web/events"
"github.com/goal-web/goal/app/console"
"github.com/goal-web/goal/app/exceptions"
"github.com/goal-web/goal/app/providers"
config2 "github.com/goal-web/goal/config"
"github.com/goal-web/goal/database/migrations"
"github.com/goal-web/goal/routes"
"github.com/goal-web/hashing"
"github.com/goal-web/http"
"github.com/goal-web/redis"
"github.com/goal-web/serialization"
"os"
)
func main() {
app := application.Singleton()
path, _ := os.Getwd()
app.Instance("path", path)
// 设置异常处理器
app.Singleton("exceptions.handler", func() contracts.ExceptionHandler {
return exceptions.NewHandler()
})
app.RegisterServices(
config.Service(os.Getenv("env"), path, config2.Configs()),
hashing.ServiceProvider{},
encryption.ServiceProvider{},
//filesystem.ServiceProvider{},
&serialization.ServiceProvider{},
events.ServiceProvider{},
redis.ServiceProvider{},
cache.ServiceProvider{},
//&bloomfilter.ServiceProvider{},
auth.ServiceProvider{},
//&ratelimiter.ServiceProvider{},
console.Service(),
database.Service(migrations.Migrations),
//&queue.ServiceProvider{},
//&email.ServiceProvider{},
&http.ServiceProvider{RouteCollectors: []interface{}{
// 路由收集器
routes.Api,
routes.WebSocket,
routes.Sse,
}},
//&session.ServiceProvider{},
//sse.ServiceProvider{},
//websocket.ServiceProvider{},
providers.App{},
//providers.Gate(),
//providers.Micro(),
&signal.ServiceProvider{},
)
app.Call(func(console3 contracts.Console, input contracts.ConsoleInput) {
console3.Run(input)
})
}