From 92b8e58977ebb2cdfceda6b728ba676715625d8a Mon Sep 17 00:00:00 2001 From: Project_IO Date: Thu, 24 Apr 2025 22:22:02 +0900 Subject: [PATCH] feat: add static router --- app.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app.go b/app.go index b7f1525..f0c90f5 100644 --- a/app.go +++ b/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 {