fix: make vercel go entrypoint internal-safe

This commit is contained in:
CJACK committed 2026-02-16 18:04:12 +08:00
1 parent 63ee2e41c2
commit 0913c477a6
4 files changed
+33 -4

No files matched your search

+4 -4
View File
@@ -4,17 +4,17 @@ import (
"net/http"
"sync"
"ds2api/internal/server"
"ds2api/app"
)
var (
once sync.Once
app *server.App
h http.Handler
)
func Handler(w http.ResponseWriter, r *http.Request) {
once.Do(func() {
app = server.NewApp()
h = app.NewHandler()
})
app.Router.ServeHTTP(w, r)
h.ServeHTTP(w, r)
}