-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
50 lines (46 loc) · 1.15 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
package main
import (
"Sgrid/server/SgridLogTraceServer"
"Sgrid/server/SgridPackageServer"
h "Sgrid/src/http"
"Sgrid/src/public"
service "Sgrid/src/service"
"fmt"
"os"
"path/filepath"
)
// func init() {
// fmt.Println(`
// ********* info **********
// 开始验证
// ********* info **********
// `)
// b, err := saas.UsesaasPerm.CheckAuth()
// if !b || err != nil {
// fmt.Println(`
// ********* error **********
// 验证失败
// ********* error **********
// `)
// return
// }
// }
func init() {
cwd, _ := os.Getwd()
public.CheckDirectoryOrCreate(filepath.Join(cwd, "server"))
public.CheckDirectoryOrCreate(filepath.Join(cwd, "server", "SgridPackageServer"))
}
func main() {
ctx := h.NewSgridServerCtx(
h.WithSgridServerType(public.PROTOCOL_HTTP),
h.WithSgridGinStatic([2]string{"/web", "dist"}),
h.WithCors(),
)
ctx.RegistryHttpRouter(service.InitService)
ctx.RegistrySubServer(SgridLogTraceServer.SgridLogTraceInstance)
ctx.RegistrySubServer(SgridPackageServer.SgridPackageInstance)
h.NewSgridServer(ctx, func(port string) {
ctx.Engine.Run(port)
fmt.Println("Sgrid Gin Http Server started on " + port)
})
}