static

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package static 提供模块无关的静态资源与单页应用挂载能力。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHTTP

func RegisterHTTP(server *kratosHTTP.Server, mounts ...Mount) error

RegisterHTTP 校验并挂载静态资源,重复路由前缀会返回错误。

Types

type Mount

type Mount struct {
	// Prefix 是 HTTP 路由前缀。
	Prefix string
	// FS 是静态资源文件系统。
	FS fs.FS
	// SPA 表示找不到真实文件时是否回退到 index.html。
	SPA bool
}

Mount 描述一项静态资源挂载。

Jump to

Keyboard shortcuts

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