dip/dip.go

35 lines
643 B
Go
Raw Normal View History

2019-12-22 18:20:45 +01:00
package main
import (
"flag"
"fmt"
"github.com/gobuffalo/packr"
2019-12-22 18:20:45 +01:00
"github.com/labstack/echo/v4"
)
func main() {
e := echo.New()
e.HideBanner = true
2019-12-22 18:20:45 +01:00
var host, port string
var templatesbox packr.Box
//var staticbox packr.Box
2019-12-22 18:20:45 +01:00
flag.Usage = Usage
2019-12-22 18:20:45 +01:00
flag.StringVar(&host, "host", "[::]", "Listen host")
flag.StringVar(&port, "port", "8080", "Listen port")
flag.Parse()
templatesbox = packr.NewBox("templates")
//staticbox = packr.NewBox("static")
builttemplates, _ := BuildTemplates(templatesbox)
e.Renderer = builttemplates
e.GET("/", Dip)
e.GET("/test", Static)
2019-12-22 18:20:45 +01:00
e.Logger.Fatal(e.Start(fmt.Sprintf("%s:%s", host, port)))
}