updated dip structure
This commit is contained in:
parent
7515cf4344
commit
cb908eb194
2
.gitignore
vendored
2
.gitignore
vendored
@ -16,4 +16,4 @@
|
||||
*.swp
|
||||
|
||||
*.ini
|
||||
dip
|
||||
/dip
|
||||
|
36
cmd/dip/main.go
Normal file
36
cmd/dip/main.go
Normal 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)))
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package dip
|
||||
|
||||
import (
|
||||
"git.paulbsd.com/paulbsd/dip/src/ip"
|
||||
"git.paulbsd.com/paulbsd/dip/src"
|
||||
"github.com/labstack/echo/v4"
|
||||
"net/http"
|
||||
"strings"
|
Loading…
Reference in New Issue
Block a user