fix: make vercel go entrypoint internal-safe

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

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)
}