initial commit

This commit is contained in:
root
2024-10-30 13:23:52 +01:00
commit 68ba48a3a2
29 changed files with 1977 additions and 0 deletions

20
http/route/static.go Normal file
View File

@@ -0,0 +1,20 @@
package route
import (
"fmt"
"github.com/gin-contrib/static"
"github.com/gin-gonic/gin"
"os"
"path/filepath"
)
func Static(e *gin.Engine) {
execPath, err := os.Executable()
if err != nil {
panic("invalid executable path")
}
execDir := filepath.Dir(execPath)
webPath := fmt.Sprintf("%s/static", execDir)
e.Use(static.Serve("/", static.LocalFile(webPath, true)))
}