Skip to main content

Crate scope_web

Crate scope_web 

Source
Expand description

§Web Server Module

Provides a locally hosted HTTP server with REST API endpoints and a single-page web UI that mirrors all CLI functionality. The server uses the same Config and DefaultClientFactory as the CLI, ensuring identical behavior.

§Usage

# Start in foreground (default port 8080)
scope web

# Custom port and bind address
scope web --port 3000 --bind 0.0.0.0

# Run as background daemon
scope web --daemon

# Stop a running daemon
scope web --stop

Modules§

api
Web API Handlers
auth
Optional bearer token authentication middleware.
monitor
WebSocket monitor handler for live token data streaming.

Structs§

AppState
Shared application state passed to all handlers via Axum extractors.

Functions§

build_router
Builds the Axum router with all API routes and static file serving.
daemon_dir
The folder of the daemon’s PID and log files.
is_daemon_child
Returns true if running as a daemon child process.
legacy_pid_file_path
Where versions before ~/.scope-bca (0.7.0 and older) kept the PID file. The migration does not copy it: a daemon those versions started is still found here (#106).
log_file_path
Returns the path to the log file for the daemon.
pid_file_path
Returns the path to the PID file for the daemon.
start_daemon
Starts the server as a background daemon (Unix only).
start_server
Starts the web server on the given address.
stop_daemon
Stops a running daemon by reading its PID file and sending SIGTERM. Tells the user what happened, as notes on out.