handlers

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAPI

func CreateAPI(db *gorm.DB) fiber.Handler

CreateAPI creates a new API

func CreateGroup

func CreateGroup(db *gorm.DB) fiber.Handler

CreateGroup creates a new group

func DeleteAPI

func DeleteAPI(db *gorm.DB) fiber.Handler

DeleteAPI deletes an API and all its parameters

func DeleteGroup

func DeleteGroup(db *gorm.DB) fiber.Handler

DeleteGroup deletes a group and all its APIs

func DuplicateAPI

func DuplicateAPI(db *gorm.DB) fiber.Handler

DuplicateAPI duplicates an API with all its parameters within the same group

func ExportAPIs

func ExportAPIs(db *gorm.DB) fiber.Handler

ExportAPIs exports selected APIs in the requested format: "html" (default), "json" (Knot JSON v1), "openapi" or "postman". The document itself is built by services.BuildExportDocument, the shared source also used by the embeddable engine facade, so both surfaces serve byte-identical payloads and filenames.

func GetAPI

func GetAPI(db *gorm.DB) fiber.Handler

GetAPI returns a single API with parameters

func GetAPIsByGroup

func GetAPIsByGroup(db *gorm.DB) fiber.Handler

GetAPIsByGroup returns all APIs in a group

func GetDistPath

func GetDistPath() (string, error)

GetDistPath returns the path to the frontend dist directory It tries multiple locations in order: 1. ./web/dist (embedded or production location) 2. ./frontend/dist (development mode in same directory) 3. ../frontend/dist (development mode from backend-go directory)

func GetGroups

func GetGroups(db *gorm.DB) fiber.Handler

GetGroups returns all groups

func GetGroupsWithAPIs

func GetGroupsWithAPIs(db *gorm.DB) fiber.Handler

GetGroupsWithAPIs returns all groups with their APIs

func HandleMCPTools

func HandleMCPTools(db *gorm.DB) fiber.Handler

HandleMCPTools handles all MCP tool calls

func ImportDocument

func ImportDocument(db *gorm.DB) fiber.Handler

ImportDocument handles the upload and import of an API documentation file per spec §8.1. The request must be multipart/form-data with a required "file" field and an optional "dryRun" form value (any truthy spelling accepted by strconv.ParseBool previews the import without writing anything). The format is auto-detected from the file bytes (Knot JSON, Postman Collection v2.0/v2.1, OpenAPI 3.x); the parsed plan is applied transactionally and the resulting counts and warnings are returned.

func ListAPIs added in v0.1.1

func ListAPIs(db *gorm.DB) fiber.Handler

ListAPIs returns a flat, paginated, searchable listing of every API ordered by its parent group's position first (group order, then API order, then id for a stable total ordering).

Supported query parameters:

page     default 1, clamped >= 1 (non-numeric -> 400)
pageSize default 50, clamped 1..100 (non-numeric -> 400)
keyword  case-insensitive substring match on name OR endpoint
groupId  exact group filter (non-numeric -> 400)
method   exact HTTP method filter, input is upper-cased first

func RegisterRoutes

func RegisterRoutes(app *fiber.App, db *gorm.DB, prefix string)

RegisterRoutes registers all API routes under the given prefix. It is the single routing source shared by SetupRoutes and the embeddable engine facade (knot.Knot.Mount), which mounts the same routes under a host-chosen prefix. It must be exported because the facade lives in the module-root package knot, a different package from this one.

func ServeEmbeddedFiles

func ServeEmbeddedFiles(embedFS fs.FS) fiber.Handler

ServeEmbeddedFiles serves static files from an embedded filesystem

func ServeStaticFiles

func ServeStaticFiles(distPath string) fiber.Handler

ServeStaticFiles serves static files from the frontend dist directory It supports both development mode (reading from ../frontend/dist) and production mode

func SetupRoutes

func SetupRoutes(app *fiber.App, db *gorm.DB)

SetupRoutes registers all API routes on the given Fiber app under the default "/api" prefix. Both the standalone server and CLI serve command use this to avoid duplication.

func UpdateAPI

func UpdateAPI(db *gorm.DB) fiber.Handler

UpdateAPI updates API basic info

func UpdateAPINote

func UpdateAPINote(db *gorm.DB) fiber.Handler

UpdateAPINote updates API note

func UpdateAPIOrders

func UpdateAPIOrders(db *gorm.DB) fiber.Handler

UpdateAPIOrders updates the order of multiple APIs

func UpdateGroup

func UpdateGroup(db *gorm.DB) fiber.Handler

UpdateGroup updates a group name

func UpdateGroupOrders

func UpdateGroupOrders(db *gorm.DB) fiber.Handler

UpdateGroupOrders updates the order of multiple groups

func UpdateParameters

func UpdateParameters(db *gorm.DB) fiber.Handler

UpdateParameters updates parameters from structure

func UpdateParametersFromJSON

func UpdateParametersFromJSON(db *gorm.DB) fiber.Handler

UpdateParametersFromJSON updates parameters from JSON

Types

This section is empty.

Jump to

Keyboard shortcuts

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