mirror of
https://github.com/MeshCore-Beacon/beacon-server.git
synced 2026-09-17 01:04:19 +00:00
add api details in router comments
This commit is contained in:
@@ -18,7 +18,7 @@ import (
|
||||
func ChannelsRouter(reader api.Reader) http.Handler {
|
||||
r := chi.NewRouter()
|
||||
|
||||
// ListChannels handles GET /api/v1/channels
|
||||
// GET /api/v1/channels
|
||||
//
|
||||
// Query params (all optional):
|
||||
//
|
||||
@@ -59,7 +59,7 @@ func ChannelsRouter(reader api.Reader) http.Handler {
|
||||
})
|
||||
|
||||
r.Route("/{channelID}", func(r chi.Router) {
|
||||
// GetChannel handles GET /api/v1/channels/{channelID}
|
||||
// GET /api/v1/channels/{channelID}
|
||||
//
|
||||
// Returns channel detail including key for hashtag channels and message count.
|
||||
// Other channel keys are server-side config; key material is never exposed via the API.
|
||||
@@ -80,7 +80,7 @@ func ChannelsRouter(reader api.Reader) http.Handler {
|
||||
}
|
||||
respond(w, http.StatusOK, channel)
|
||||
})
|
||||
// ListChannelMessages handles GET /api/v1/channels/{channelID}/messages
|
||||
// GET /api/v1/channels/{channelID}/messages
|
||||
//
|
||||
// Query params (all optional):
|
||||
//
|
||||
|
||||
@@ -15,6 +15,8 @@ import (
|
||||
func IATAsRouter(reader api.Reader) http.Handler {
|
||||
r := chi.NewRouter()
|
||||
|
||||
// GET /iatas → ListIATAs
|
||||
//
|
||||
// Returns all known IATA codes with display name and coordinates where set.
|
||||
// IATAs are auto-created on first packet arrival; config file overrides name/coords.
|
||||
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -26,6 +28,8 @@ func IATAsRouter(reader api.Reader) http.Handler {
|
||||
respond(w, http.StatusOK, iatas)
|
||||
})
|
||||
|
||||
// GET /iatas/{iata} → GetIATA
|
||||
//
|
||||
// Returns detail for a single IATA code including associated region memberships
|
||||
// and basic recent stats.
|
||||
r.Get("/{iata}", func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
func MessagesRouter(reader api.Reader) http.Handler {
|
||||
r := chi.NewRouter()
|
||||
|
||||
// ListMessages handles GET /api/v1/messages
|
||||
// GET /api/v1/messages
|
||||
//
|
||||
// Query params (all optional)
|
||||
//
|
||||
|
||||
@@ -19,6 +19,8 @@ import (
|
||||
func RegionsRouter(reader api.Reader) http.Handler {
|
||||
r := chi.NewRouter()
|
||||
|
||||
// GET /regions → ListRegions
|
||||
//
|
||||
// Returns all super-regions with their associated IATA codes, center
|
||||
// coordinates, and zoom level for map initialisation.
|
||||
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -29,6 +31,8 @@ func RegionsRouter(reader api.Reader) http.Handler {
|
||||
respond(w, http.StatusOK, regions)
|
||||
})
|
||||
|
||||
// GET /regions/{regionId} → GetRegion
|
||||
//
|
||||
// Returns detail for a single super-region including its full IATA membership
|
||||
// list and recent aggregate stats.
|
||||
r.Get("/{regionId}", func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user