feat: middleware, expvar

This commit is contained in:
2026-04-27 14:02:26 +02:00
parent 2fd3a1d57b
commit 7affd35ae4
5 changed files with 44 additions and 11 deletions
+3
View File
@@ -1,6 +1,7 @@
package main
import (
"expvar"
"net/http"
"github.com/julienschmidt/httprouter"
@@ -27,6 +28,8 @@ func (app *application) routes() http.Handler {
router.HandlerFunc(http.MethodPost, "/v1/tokens/authentication",
app.createAuthenticationTokenHandler)
// Register a new GET /debug/vars endpoint pointing to the expvar handler.
router.Handler(http.MethodGet, "/debug/vars", expvar.Handler())
return app.recoverPanic(app.enableCORS(app.rateLimit(app.authenticate(router))))
}