web

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package web serves the whodar web UI: a search page and a JSON ask API over the same engine the CLI uses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(cfg Config) (http.Handler, error)

Handler returns the whodar web handler: an index page, embedded assets, and a JSON ask API. It panics if cfg.Ask is nil.

Types

type AskFunc

type AskFunc func(ctx context.Context, query, mode string, limit int) (resolve.Answer, error)

AskFunc resolves a query in the chosen mode and returns the answer.

type Config

type Config struct {
	// Ask resolves queries; required.
	Ask AskFunc
	// Feedback records votes on results; nil disables the feedback API.
	Feedback FeedbackFunc
	// Person returns full person profiles; nil disables the person API.
	Person PersonFunc
	// Version is shown in the page footer.
	Version string
}

Config configures the web handler.

type FeedbackFunc added in v0.1.10

type FeedbackFunc func(feedback.Entry) error

FeedbackFunc records a user's vote on one result.

type PersonFunc added in v0.1.15

type PersonFunc func(id string) (resolve.JSONProfile, bool)

PersonFunc returns the full profile for a person identifier, or false when the person is unknown.

Jump to

Keyboard shortcuts

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