feat: fully complete SPA embedding

This commit is contained in:
Damillora 2025-02-23 19:56:39 +00:00
parent 69abeb93cb
commit fa81548e8a
3 changed files with 4 additions and 18 deletions

View File

@ -34,11 +34,12 @@ func Start() {
webFS := web.WebAssets()
webAssets, _ := fs.Sub(webFS, "_app")
g.StaticFileFS("/", "./app.html", http.FS(webFS))
// g.StaticFile("/", "./pkg/web/build/index.html")
g.NoRoute(func(c *gin.Context) {
//c.String(http.StatusOK, "AAA")
c.FileFromFS("./app.html", http.FS(webFS))
})
g.StaticFS("/_app", http.FS(webAssets))
g.Static("/data", config.CurrentConfig.DataDirectory)
g.Use(cors.Default())
InitializeRoutes(g)

View File

@ -1,13 +0,0 @@
package app
import (
"github.com/gin-gonic/gin"
)
func InitializeFrontendRoutes(g *gin.Engine) {
g.NoRoute(frontendHome)
}
func frontendHome(c *gin.Context) {
c.File("./web/static/index.html")
}

View File

@ -11,6 +11,4 @@ func InitializeRoutes(g *gin.Engine) {
InitializeTagRoutes(g)
InitializeBlobRoutes(g)
InitializePostRoutes(g)
InitializeFrontendRoutes(g)
}