https dev fix + util cleanup
This commit is contained in:
16
src/main.go
16
src/main.go
@@ -50,10 +50,12 @@ func main() {
|
||||
|
||||
e.Logger.SetLevel(log.DEBUG)
|
||||
e.Use(middleware.Logger())
|
||||
e.Use(middleware.Gzip())
|
||||
e.Use(middleware.HTTPSRedirect())
|
||||
if util.IsProd() {
|
||||
e.Use(middleware.Gzip())
|
||||
e.Use(middleware.HTTPSRedirect())
|
||||
}
|
||||
|
||||
e.GET("/health", healthCheck)
|
||||
e.GET("/health", util.HealthCheck)
|
||||
|
||||
e.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
@@ -68,12 +70,10 @@ func main() {
|
||||
e.Static("/css", "css")
|
||||
e.Static("/js", "js")
|
||||
|
||||
e.Logger.Info(boxes.GetBoxes())
|
||||
|
||||
e.GET("/", func(c echo.Context) error {
|
||||
return c.Render(200, "index", newPage(boxes.GetBoxes()))
|
||||
})
|
||||
e.GET("/boxes/ws", boxes.InitWs)
|
||||
e.GET("/boxes/ws", boxes.HandleBoxesWs)
|
||||
|
||||
e.File("/favicon.ico", "images/favicon.ico")
|
||||
|
||||
@@ -84,7 +84,3 @@ func main() {
|
||||
|
||||
e.Logger.Fatal(e.Start(":54321"))
|
||||
}
|
||||
|
||||
func healthCheck(c echo.Context) error {
|
||||
return c.String(200, "OK")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user