webserver

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package webserver exposes gocrawl over HTTP: an API to start and inspect crawls, backed by the same runner.Run seam the CLI and MCP server use, plus the embedded single-page app (see assets.go) that drives it from a browser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	ID         string
	Seed       string
	Status     Status
	Report     *report.Report
	Err        string
	StartedAt  time.Time
	FinishedAt time.Time
	StoreID    string // set once the report is saved, so history and job views agree on one ID
	// contains filtered or unexported fields
}

Job tracks one in-flight or just-finished crawl started via the web API.

type JobView

type JobView struct {
	ID         string         `json:"id"`
	Seed       string         `json:"seed"`
	Status     string         `json:"status"`
	Err        string         `json:"error,omitempty"`
	StartedAt  string         `json:"started_at,omitempty"`
	FinishedAt string         `json:"finished_at,omitempty"`
	Persisted  bool           `json:"persisted"`
	Report     *report.Report `json:"report,omitempty"`
}

JobView is the API representation of a Job.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server serves the gocrawl web API and embedded frontend.

func New

func New(st *store.Store) *Server

New builds a Server backed by st for crawl history (persisted via --save).

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the http.Handler serving the API and frontend.

type Status

type Status string

Status is the lifecycle state of a crawl job.

const (
	StatusRunning  Status = "running"
	StatusDone     Status = "done"
	StatusError    Status = "error"
	StatusCanceled Status = "canceled"
)

Jump to

Keyboard shortcuts

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