feat: add static router
This commit is contained in:
parent
d651b40df7
commit
92b8e58977
1 changed files with 2 additions and 4 deletions
6
app.go
6
app.go
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/devproje/commando/option"
|
||||
"github.com/devproje/commando/types"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
|
@ -32,10 +33,7 @@ func daemon(n *commando.Node) error {
|
|||
}
|
||||
|
||||
app := gin.Default()
|
||||
|
||||
app.NoRoute(func(ctx *gin.Context) {
|
||||
ctx.HTML(200, "index.html", nil)
|
||||
})
|
||||
app.StaticFS("/", http.Dir("public"))
|
||||
|
||||
fmt.Printf("web server binding at: http://%s:%d\n", cnf.Service.Host, cnf.Service.Port)
|
||||
if err = app.Run(fmt.Sprintf("%s:%d", cnf.Service.Host, cnf.Service.Port)); err != nil {
|
||||
|
|
Loading…
Reference in a new issue