Made autodeploy pipeline

This commit is contained in:
2026-05-19 14:35:04 +03:00
parent b17b43b17a
commit b6447cce63
10 changed files with 285 additions and 9 deletions
+2
View File
@@ -128,6 +128,8 @@ func NewServer(cfg config.Config) *Server {
authRouter := routers.NewAuthRouter(authService)
authRouter.RegisterRouter(apiV1)
// подключаем статику Vue — должно быть последним
registerStaticFiles(router)
return &Server{
httpServer: &http.Server{
Addr: cfg.APIHost + ":" + cfg.APIPort,
+27
View File
@@ -0,0 +1,27 @@
package api
import (
"embed"
"io/fs"
"net/http"
"github.com/gin-gonic/gin"
)
//go:embed dist
var staticFiles embed.FS
func registerStaticFiles(router *gin.Engine) {
// вырезаем префикс dist/ чтобы / отдавал index.html
distFS, err := fs.Sub(staticFiles, "dist")
if err != nil {
panic(err)
}
fileServer := http.FileServer(http.FS(distFS))
// все маршруты которые не /api и не /openapi — отдаём Vue
router.NoRoute(func(c *gin.Context) {
fileServer.ServeHTTP(c.Writer, c.Request)
})
}