30 lines
491 B
Go
30 lines
491 B
Go
package main
|
|
|
|
import (
|
|
"embed"
|
|
"github.com/gin-gonic/gin"
|
|
"html/template"
|
|
"io/fs"
|
|
m "k8s-manager/src"
|
|
"log"
|
|
"net/http"
|
|
)
|
|
|
|
//go:embed template/* static/*
|
|
var f embed.FS
|
|
|
|
func main() {
|
|
r := gin.Default()
|
|
|
|
r.SetHTMLTemplate(template.Must(template.New("").ParseFS(f, "template/*")))
|
|
fp, _ := fs.Sub(f, "static")
|
|
r.StaticFS("/static", http.FS(fp))
|
|
|
|
r.GET("/app", m.JWTAuthMiddleware, m.AppPage)
|
|
r.GET("/test/:username", m.Test)
|
|
err := r.Run()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|