fix(server): fix route conflict by using /dist prefix for static assets
Previously, static assets were served from the root "/" and "/assets" routes, which caused conflicts with the "/api" route. Changed to serve all static assets under the "/dist" prefix to avoid route collisions.
This commit is contained in:
@@ -5,8 +5,6 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"markdown-editor/internal/storage"
|
||||
"markdown-editor/internal/api"
|
||||
@@ -95,9 +93,8 @@ func (s *Server) serveStaticAssets() {
|
||||
|
||||
s.log.Infof("Serving static assets from: %s", assetPath)
|
||||
|
||||
// Serve files from the dist directory
|
||||
s.router.Static("/", assetPath)
|
||||
s.router.Static("/assets", filepath.Join(assetPath, "assets"))
|
||||
// Serve files from the dist directory - use /dist prefix to avoid conflicts with /api
|
||||
s.router.Static("/dist", assetPath)
|
||||
}
|
||||
|
||||
func (s *Server) Shutdown(ctx context.Context) error {
|
||||
|
||||
Reference in New Issue
Block a user