eth-indexer/internal/api/api.go

23 lines
336 B
Go
Raw Permalink Normal View History

2024-06-10 09:36:26 +02:00
package api
import (
"net/http"
"github.com/VictoriaMetrics/metrics"
"github.com/go-chi/chi/v5"
2024-06-10 09:36:26 +02:00
)
func New() *chi.Mux {
r := chi.NewRouter()
2024-06-10 09:36:26 +02:00
r.Get("/metrics", metricsHandler())
2024-06-10 09:36:26 +02:00
return r
2024-06-10 09:36:26 +02:00
}
func metricsHandler() http.HandlerFunc {
return func(w http.ResponseWriter, _ *http.Request) {
2024-06-10 09:36:26 +02:00
metrics.WritePrometheus(w, true)
}
}