-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
41 lines (31 loc) · 778 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
package main
import (
"io"
"log"
"text/template"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
type Template struct {
templates *template.Template
}
func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Context) error {
return t.templates.ExecuteTemplate(w, name, data)
}
func RenderRoutes(e *echo.Echo) {
e.GET(RoutesInstance.MAIN, HandlerMain)
e.GET(RoutesInstance.MONITOR, HandlerMonitor)
}
func main() {
log.Println("Server Health Monitor is running...")
t := &Template{
templates: template.Must(template.ParseGlob("html/*.html")),
}
e := echo.New()
e.Renderer = t
e.Use(middleware.Logger())
e.Use(middleware.Recover())
e.Static("/", "html")
RenderRoutes(e)
e.Logger.Fatal(e.Start(":1313"))
}