assetserve

package module
v0.0.0-...-364ae85 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: MIT Imports: 9 Imported by: 0

README

assetserve

Golang静态资源服务


//内置到执行程序的资源目录
//go:embed assets
var assets embed.FS

func TestServer(t *testing.T) {
    server := NewAssetsHttpServer()
    server.AssetsFSName = "assets" //必须设置目录名
    server.Assets = &assets
    err := server.StartHttpServer()
    fmt.Println(err)
}

http://localhost/xxx.png

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAssetsHttpServer

func NewAssetsHttpServer() *assetsHttpServer

Types

type SSL

type SSL struct {
	SSLCert string
	SSLKey  string
}

证书配置,根据 Assets 或 LocalAssets 寻找证书文件位置

Jump to

Keyboard shortcuts

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