I am using gin-static to host vue3 app.
Here is my code:
func initStatics(engine *gin.Engine) {
engine.Use(static.Serve("/", static.EmbedFolder(embedFs.Embed, "dist")))
engine.NoRoute(func(ctx *gin.Context) {
ctx.Redirect(http.StatusMovedPermanently, "/")
})
}
func InitGinEngine() *gin.Engine {
engine := gin.Default()
jwtMiddleware := middleware.InitJWTMiddleware()
initRouter(engine, jwtMiddleware)
initStatics(engine)
return engine
}
every time I refresh the page, it just redirect to the root path? Is there any way to make it loading correct path?