refactor(hub): separate development and production server logic

This commit is contained in:
henrygd
2025-09-01 19:27:11 -04:00
parent fc39ff1e4d
commit fadfc5d81d
4 changed files with 81 additions and 55 deletions

View File

@@ -0,0 +1,23 @@
//go:build development
package hub
import (
"net/http/httputil"
"net/url"
"github.com/pocketbase/pocketbase/core"
)
// startServer sets up the development server for Beszel
func (h *Hub) startServer(se *core.ServeEvent) error {
proxy := httputil.NewSingleHostReverseProxy(&url.URL{
Scheme: "http",
Host: "localhost:5173",
})
se.Router.GET("/{path...}", func(e *core.RequestEvent) error {
proxy.ServeHTTP(e.Response, e.Request)
return nil
})
return nil
}