fix: make vercel go entrypoint internal-safe
This commit is contained in:
1 parent
63ee2e41c2
commit
0913c477a6
4 files changed
+33
-4
No files matched your search
+4
-4
@@ -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)
|
||||
}
|
||||
Reference in new issue
Block a user