api

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggingMiddleware

func LoggingMiddleware(next http.Handler) http.Handler

LoggingMiddleware wraps an http.Handler to log the remote address, method, path, and duration of every request to stdout.

func RegisterRoutes

func RegisterRoutes(mux *http.ServeMux)

RegisterRoutes registers all API endpoints on the provided mux.

Types

type DiffRequest

type DiffRequest struct {
	Base    string `json:"base"`
	Compare string `json:"compare"`
}

DiffRequest represents the JSON payload for the POST /api/diff endpoint.

type DiffResponse

type DiffResponse struct {
	OpCodes      []OpCodeInfo `json:"opCodes"`
	BaseLines    []string     `json:"baseLines"`
	CompareLines []string     `json:"compareLines"`
}

DiffResponse is the structured JSON response for custom UI rendering.

type OpCodeInfo

type OpCodeInfo struct {
	Tag string `json:"tag"` // "equal", "replace", "delete", "insert"
	I1  int    `json:"i1"`
	I2  int    `json:"i2"`
	J1  int    `json:"j1"`
	J2  int    `json:"j2"`
}

OpCodeInfo describes a block of changed/unchanged lines.

Jump to

Keyboard shortcuts

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