routes

package
v0.0.54 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

README

routes

Defines and serves the Gin HTTP router for the API server. Responsible for wiring handler functions to paths and methods, applying middleware, and starting the HTTP listener on the host and port from config. All API endpoints are registered under the /api/v1 prefix. A Swagger UI is served at /swagger/ and is auto-generated from source annotations using swag init. Route handlers are organized into subpackages by domain — agent, scoring, users, graphs, and miscellaneous — and registered from this package.

Whether the PostgreSQL sink is configured determines which routes are active. Routes that require database access are substituted at startup with handlers that return 501 Not Implemented when no sink is configured; the database middleware is similarly replaced with a no-op. Agent-facing routes for fetching checks and submitting scores are always registered, but score persistence is silently skipped when no sink is present.

Documentation

Overview

Package routes contains all of the Gin HTTP API logic. This is includes which functions are responsible for which paths and methods, user input parsing and validation, as well as request logging and error handling. Most Gin handler functions are located in subpackages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(router *gin.Engine, s config.Sinks)

RegisterRoutes registers all API routes on router. Called by initRoutes and tests. Routes that require the db are replaced with 501 not implemented.

func ServeRoutes

func ServeRoutes(cfg *config.APIConfigSpec) error

ServeRoutes generates an HTTP router and starts listening! Requires the config to be loaded.

Types

This section is empty.

Directories

Path Synopsis
Package graphs contains routes that generate html/js graphs that can be embedded into other pages.
Package graphs contains routes that generate html/js graphs that can be embedded into other pages.
Package misc contains routes that don't belong in other categories.
Package misc contains routes that don't belong in other categories.
Package scoring contains all the routes involving scorechecks.
Package scoring contains all the routes involving scorechecks.
Package users contains all the API routes involving scoring users.
Package users contains all the API routes involving scoring users.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL