-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
87 lines (65 loc) · 1.83 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package main
import (
"chatdan_backend/bootstrap"
_ "chatdan_backend/docs"
"chatdan_backend/utils"
"go.uber.org/zap"
"log"
"os"
"os/signal"
"syscall"
)
// @title ChatDan Backend
// @version 0.0.1
// @description ChatDan, a message box and 'biaobai' platform for Fudaners.
// @termsOfService https://swagger.io/terms/
// @tag.name User Module
// @tag.description 用户模块
// @tag.name MessageBox Module
// @tag.description 提问箱模块
// @tag.name Post Module
// @tag.description 帖子模块
// @tag.name Channel Module
// @tag.description 帖子回复 thread 模块
// @tag.name Wall Module
// @tag.description 表白墙模块
// @tag.name Division Module
// @tag.description 广场分区模块
// @tag.name Topic Module
// @tag.description 广场话题模块
// @tag.name Comment Module
// @tag.description 广场评论模块
// @tag.name Tag Module
// @tag.description 广场标签模块
// @tag.name Chat Module
// @tag.description 聊天模块
// @contact.name JingYiJun
// @contact.url https://www.jingyijun.xyz
// @contact.email [email protected]
// @license.name Apache 2.0
// @license.url https://www.apache.org/licenses/LICENSE-2.0.html
// @host localhost:8000
// @BasePath /api
// @securityDefinitions.apikey ApiKeyAuth
// @in header
// @name Authorization
//go:generate go install github.com/swaggo/swag/cmd/swag@latest
//go:generate swag init
func main() {
app := bootstrap.InitFiberApp()
go func() {
if innerErr := app.Listen("0.0.0.0:8000"); innerErr != nil {
log.Println(innerErr)
}
}()
interrupt := make(chan os.Signal, 1)
// wait for CTRL-C interrupt
signal.Notify(interrupt, syscall.SIGINT, syscall.SIGTERM)
<-interrupt
// close app
err := app.Shutdown()
if err != nil {
utils.Logger.Error("app shutdown error", zap.Error(err))
}
_ = utils.Logger.Sync()
}