mirror of
https://gitee.com/energye/energy.git
synced 2024-12-04 20:58:21 +08:00
18 lines
708 B
Markdown
18 lines
708 B
Markdown
|
可将html css javascript image等静态资源放入该目录,编译后将内置到执行程序中
|
|||
|
|
|||
|
通过内置http server 读取该目录文件,展示到页面中
|
|||
|
```go
|
|||
|
//内置http服务链接安全配置
|
|||
|
assetserve.AssetsServerHeaderKeyName = "energy"
|
|||
|
assetserve.AssetsServerHeaderKeyValue = "energy"
|
|||
|
//内置http服务链接安全配置
|
|||
|
cef.SetBrowserProcessStartAfterCallback(func(b bool) {
|
|||
|
fmt.Println("主进程启动 创建一个内置http服务")
|
|||
|
//通过内置http服务加载资源
|
|||
|
server := assetserve.NewAssetsHttpServer()
|
|||
|
server.PORT = 22022
|
|||
|
server.AssetsFSName = "resources" //必须设置目录名
|
|||
|
server.Assets = &resources
|
|||
|
go server.StartHttpServer()
|
|||
|
})
|
|||
|
```
|