-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
33 lines (29 loc) · 811 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
package main
import (
"log"
"github.com/gin-gonic/gin"
"github.com/space-w-alker/chat-room-server/auth"
"github.com/space-w-alker/chat-room-server/database"
"github.com/space-w-alker/chat-room-server/model/chat"
"github.com/space-w-alker/chat-room-server/model/chat_room"
"github.com/space-w-alker/chat-room-server/model/room_tag"
"github.com/space-w-alker/chat-room-server/model/user"
"github.com/spf13/viper"
)
func init() {
viper.SetConfigFile(".local.env")
viper.ReadInConfig()
database.InitDB()
}
func main() {
r := gin.Default()
user.RegisterHandlers(r)
auth.RegisterHandlers(r)
chat.RegisterHandlers(r)
chat_room.RegisterHandlers(r)
room_tag.RegisterHandlers(r)
r.Static("public", "./public")
r.StaticFile("/favicon.ico", "./public/favicon.ico")
err := r.Run()
log.Fatal(err)
}