mirror of
https://github.com/Damillora/phoebe.git
synced 2025-03-10 14:07:22 +00:00
feat: fully complete SPA embedding
This commit is contained in:
parent
69abeb93cb
commit
fa81548e8a
@ -34,11 +34,12 @@ func Start() {
|
|||||||
webFS := web.WebAssets()
|
webFS := web.WebAssets()
|
||||||
webAssets, _ := fs.Sub(webFS, "_app")
|
webAssets, _ := fs.Sub(webFS, "_app")
|
||||||
|
|
||||||
g.StaticFileFS("/", "./app.html", http.FS(webFS))
|
g.NoRoute(func(c *gin.Context) {
|
||||||
// g.StaticFile("/", "./pkg/web/build/index.html")
|
//c.String(http.StatusOK, "AAA")
|
||||||
|
c.FileFromFS("./app.html", http.FS(webFS))
|
||||||
|
})
|
||||||
g.StaticFS("/_app", http.FS(webAssets))
|
g.StaticFS("/_app", http.FS(webAssets))
|
||||||
g.Static("/data", config.CurrentConfig.DataDirectory)
|
g.Static("/data", config.CurrentConfig.DataDirectory)
|
||||||
|
|
||||||
g.Use(cors.Default())
|
g.Use(cors.Default())
|
||||||
|
|
||||||
InitializeRoutes(g)
|
InitializeRoutes(g)
|
||||||
|
@ -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")
|
|
||||||
}
|
|
@ -11,6 +11,4 @@ func InitializeRoutes(g *gin.Engine) {
|
|||||||
InitializeTagRoutes(g)
|
InitializeTagRoutes(g)
|
||||||
InitializeBlobRoutes(g)
|
InitializeBlobRoutes(g)
|
||||||
InitializePostRoutes(g)
|
InitializePostRoutes(g)
|
||||||
|
|
||||||
InitializeFrontendRoutes(g)
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user