2019-12-22 18:20:45 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
|
2020-01-19 17:30:10 +01:00
|
|
|
"github.com/gobuffalo/packr"
|
2019-12-22 18:20:45 +01:00
|
|
|
"github.com/labstack/echo/v4"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
e := echo.New()
|
2020-01-19 17:30:10 +01:00
|
|
|
e.HideBanner = true
|
2019-12-22 18:20:45 +01:00
|
|
|
|
|
|
|
var host, port string
|
2020-01-19 17:30:10 +01:00
|
|
|
var templatesbox packr.Box
|
|
|
|
//var staticbox packr.Box
|
2019-12-22 18:20:45 +01:00
|
|
|
|
2020-01-19 17:30:10 +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()
|
|
|
|
|
2020-01-19 17:30:10 +01:00
|
|
|
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)))
|
|
|
|
}
|