Konfi-Castle-Kasino/src/KonfiCastleKasino/main.go

40 lines
735 B
Go
Raw Normal View History

2017-06-15 09:30:32 +00:00
package main
import (
"github.com/labstack/echo"
"github.com/labstack/echo/middleware"
"html/template"
"github.com/labstack/gommon/log"
)
func main(){
//Config
SiteConf := initConfig()
//Echo init
e := echo.New()
//Logger
e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{
Format: "${time_rfc3339}: ${remote_ip} ${method} ${status} ${uri} - ${user_agent}\n",
}))
//Static ontent
e.Static("/assets", "assets")
//Routes
e.GET("/", showList)
e.GET("/list", getList)
e.GET("/admin", adminHandler)
//Template
t := &Template{
templates: template.Must(template.ParseGlob("tpl/*.html")),
}
e.Renderer = t
//Start the server
e.Logger.SetLevel(log.ERROR)
e.Logger.Debug(e.Start(SiteConf.Interface))
}