forked from muxi-mini-project/2023-Melting-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (38 loc) · 819 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
package main
import (
"github.com/gin-gonic/gin"
"log"
_ "main/docs"
"main/router"
"main/service"
)
// @title Melting API
// @description Backend system of Muxi_Melting
// @description.markdown
// @version 1.7
// @contact.name @a48zhang & @Cg1028
// @contact.email [email protected] [email protected]
// @schemes https
// @BasePath /api/v1
func main() {
service.Logger()
service.InitService()
errs := make(chan error, 1024)
go func(ch chan error) {
err := router.Register(gin.Default()).RunTLS(service.ServerAddr, service.TLSCert, service.TLSKey)
if err != nil {
errs <- err
return
}
}(errs)
go func(ch chan error) {
err := router.WSHandlerRegister(gin.Default()).Run(":24769")
if err != nil {
errs <- err
return
}
}(errs)
if err, ok := <-errs; ok {
log.Fatal(err)
}
}