updated dip structure

This commit is contained in:
Paul 2020-01-26 18:03:09 +01:00
parent 7515cf4344
commit cb908eb194
6 changed files with 38 additions and 2 deletions

2
.gitignore vendored
View File

@ -16,4 +16,4 @@
*.swp *.swp
*.ini *.ini
dip /dip

36
cmd/dip/main.go Normal file
View File

@ -0,0 +1,36 @@
package main
import (
"flag"
"fmt"
"git.paulbsd.com/paulbsd/dip/packrd"
"git.paulbsd.com/paulbsd/dip/src"
"github.com/gobuffalo/packr/v2"
"github.com/labstack/echo/v4"
)
func main() {
e := echo.New()
e.HideBanner = true
var host, port string
flag.Usage = dip.Usage
flag.StringVar(&host, "host", "[::]", "Listen host")
flag.StringVar(&port, "port", "8080", "Listen port")
flag.Parse()
templatesbox := packr.New("templates", "./templates")
staticbox := packr.New("static", "./static")
builtTemplates, _ := templates.BuildTemplates(templatesbox)
e.Renderer = builtTemplates
e.GET("/", dip.Dip)
e.GET("/static/*", func(c echo.Context) error {
return static.Static(staticbox, c)
})
e.Logger.Fatal(e.Start(fmt.Sprintf("%s:%s", host, port)))
}

View File

@ -1,7 +1,7 @@
package dip package dip
import ( import (
"git.paulbsd.com/paulbsd/dip/src/ip" "git.paulbsd.com/paulbsd/dip/src"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"net/http" "net/http"
"strings" "strings"