forked from hyperjiang/gin-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
33 lines (24 loc) · 741 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 (
"flag"
"path/filepath"
"github.com/gin-gonic/gin"
_ "github.com/golang/glog"
"github.com/hyperjiang/gin-skeleton/config"
"github.com/hyperjiang/gin-skeleton/router"
)
func main() {
addr := flag.String("addr", config.Server.Addr, "Address to listen and serve")
flag.Parse()
if config.Server.Mode == gin.ReleaseMode {
gin.DisableConsoleColor()
}
app := gin.Default()
app.Static("/images", filepath.Join(config.Server.StaticDir, "img"))
app.StaticFile("/favicon.ico", filepath.Join(config.Server.StaticDir, "img/favicon.ico"))
app.LoadHTMLGlob(config.Server.ViewDir + "/*")
app.MaxMultipartMemory = config.Server.MaxMultipartMemory << 20
router.Route(app)
// Listen and Serve
app.Run(*addr)
}