Files
beacon-server/internal/api/handlers/info.go
MrAlders0n 9bbf8efee5 release: v2.0.4 (#217)
* perf(routes): batch cross-IATA and hash route search (#216)

One search fired a /routes/cross request per IATA pair (138k on 2026-10-08). Route search now takes an optional iatas list and runs a fixed number of index-backed queries. /info advertises built-in minimum client versions.

* chore: bump version to 2.0.4
2026-10-09 22:17:23 -04:00

36 lines
989 B
Go

// Copyright 2026 Beacon Contributors
// SPDX-License-Identifier: AGPL-3.0-or-later
package handlers
import (
"net/http"
"github.com/MeshCore-Beacon/beacon-server/internal/api"
"github.com/go-chi/chi/v5"
)
// InfoRouter mounts GET /info. Clients treat a 404 as "no requirement",
// so this route must stay mounted once shipped.
func InfoRouter(info api.Info) http.Handler {
r := chi.NewRouter()
r.Get("/", getInfo(info))
return r
}
// getInfo godoc
//
// @Summary Server info and minimum client versions
// @Description minAppVersion (BEACON Mobile) and minWebVersion (Beacon Web) are null when the
// @Description server sets no requirement. Each is the higher of the built-in floor and config.
// @Tags Info
// @Produce json
// @Success 200 {object} api.Info
// @Router /info [get]
func getInfo(info api.Info) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-cache")
respond(w, http.StatusOK, info)
}
}