server

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package server 把 vault 与 render 组装成 HTTP 服务。 本包不含业务逻辑,只做路由、参数校验与序列化。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server 持有各组件并暴露 HTTP 接口。

func New

func New(v vault.Vault, r *render.Renderer, webFS fs.FS) *Server

New 构造 Server。webFS 是 embed 进来的前端资源文件系统。

func (*Server) Handler

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

Handler 返回可直接挂到 http.Server 上的处理器。

func (*Server) StartWatching

func (s *Server) StartWatching(ctx context.Context)

StartWatching 启动文件监听循环,把 vault 的变更广播给所有已连接的浏览器。 ctx 结束时循环退出。

Jump to

Keyboard shortcuts

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