Hey I am having trouble to implement a full frontend in my backend. I have a directory called public where a index.html is placed. Now I want the api routes to be listening on /api/ subgroup and everything else should redirect to index.html since my react frontend does manage the routing on its own. I am always getting an error when trying to start that configuration. This is my code:

func main() {
    r := gin.Default()

    // API-Routes
    api := r.Group("/api")
    routes.RegisterRoutes(api)

    // Static routes
    r.Static("/", "./public")

    // Fallback for SPA
    r.NoRoute(func(c *gin.Context) {
        c.File("./public/index.html")
    })

    if err := r.Run(":8080"); err != nil {
        println("Error starting server:", err)
    }
}

[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production. - using env: export GIN_MODE=release - using code: gin.SetMode(gin.ReleaseMode)

[GIN-debug] GET /api/ping --> github.com/marvn/hms/backend/handlers.Ping (3 handlers) [GIN-debug] GET /filepath --> github.com/gin-gonic/gin.(RouterGroup).createStaticHandler.func1 (3 handlers) panic: catch-all wildcard 'filepath' in new path '/filepath' conflicts with existing path segment 'api' in existing prefix '/api'

Can I somehow fix this? BTW is there a discord or anything where I can ask those questions instead of opening an issue on Github? THx for your help!