35 lines
643 B
Go
35 lines
643 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
|
|
"github.com/gobuffalo/packr"
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
func main() {
|
|
e := echo.New()
|
|
e.HideBanner = true
|
|
|
|
var host, port string
|
|
var templatesbox packr.Box
|
|
//var staticbox packr.Box
|
|
|
|
flag.Usage = Usage
|
|
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)
|
|
|
|
e.Logger.Fatal(e.Start(fmt.Sprintf("%s:%s", host, port)))
|
|
}
|