/
main.go
53 lines (40 loc) · 892 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
44
45
46
47
48
49
50
51
52
53
package main
//
// Reference
//
// https://github.com/Sirupsen/logrus
//
//go:generate go-bindata-assetfs -ignore=\\.gitignore view/... static/...
import (
"github.com/labstack/echo"
"github.com/labstack/echo/engine/standard"
"fmt"
log "github.com/Sirupsen/logrus"
"os"
"net/http"
)
type Config struct {
Port int
}
func main() {
log.SetFormatter(&log.JSONFormatter{})
log.SetOutput(os.Stdout)
log.SetLevel(log.InfoLevel)
config := Config{
Port: 8080,
}
e := echo.New()
err := InitializeWebsocket(e)
if err != nil {
panic(err)
}
err = InitializeRenderers(e)
if err != nil {
panic(err)
}
e.GET("/", func(c echo.Context) error {
return c.Render(http.StatusOK, "view/index.html", "")
})
log.Info(config)
e.Run(standard.New(fmt.Sprintf(":%d", config.Port)))
}