func NewDiagHandler(fs *firestore.Client, startTime time.Time) http.HandlerFunc {
	return func(rw http.ResponseWriter, r *http.Request) {
		uptime := int(time.Since(startTime).Seconds())

		registered, err := countWebhooks(fs)
		if err != nil {
			log.Println("Error while counting webhooks:", err.Error())
			registered = -1 // Just return a nonsense count, which more useful in this particular case
		}

		response := diag{
			GetStatusOf(MMediaGroupAPIRootPath + "/cases"),
			GetStatusOf(CovidTrackerAPIRootPath[0 : len(CovidTrackerAPIRootPath)-3]),
			GetStatusOf(RestCountriesRootPath),
			registered,
			Version,
			uptime,
		}

		_ = json.NewEncoder(rw).Encode(response)
	}
}
// NewDiagHandler returns a handler function for the diagnostic endpoint.
NewDiagHandler returns a handler function for the diagnostic endpoint.
// NewDiagHandler returns a handler function for the diagnostic endpoint .
func NewDiagHandler(fs *firestore.Client, startTime time.Time) http.HandlerFunc {
	return func(rw http.ResponseWriter, r *http.Request) {
		uptime := int(time.Since(startTime).Seconds())
		registered, err := countWebhooks(fs)
		if err != nil {
			log.Println("Error while counting webhooks:", err.Error())
			registered = -1 
		}
		response := diag{
			GetStatusOf(MMediaGroupAPIRootPath + "/cases"),
			GetStatusOf(CovidTrackerAPIRootPath[0 : len(CovidTrackerAPIRootPath)-3]),
			GetStatusOf(RestCountriesRootPath),
			registered,
			Version,
			uptime,
		}
		_ = json.NewEncoder(rw).Encode(response)
	}
}
func NewDiagHandler ( fs * firestore . Client , startTime time . Time ) http . HandlerFunc { return func ( rw http . ResponseWriter , r * http . Request ) { uptime := int ( time . Since ( startTime ) . Seconds ( ) ) registered , err := countWebhooks ( fs ) if err != nil { log . Println ( " " , err . Error ( ) ) registered = - 1 } response := diag { GetStatusOf ( MMediaGroupAPIRootPath + " " ) , GetStatusOf ( CovidTrackerAPIRootPath [ 0 : len ( CovidTrackerAPIRootPath ) - 3 ] ) , GetStatusOf ( RestCountriesRootPath ) , registered , Version , uptime , } _ = json . NewEncoder ( rw ) . Encode ( response ) } }
NewDiagHandler returns a handler function for the diagnostic endpoint.
NewDiagHandler returns a handler function for the diagnostic endpoint .
// Just return a nonsense count, which more useful in this particular case