1
0
mirror of https://github.com/fumiama/go-web-wrapper.git synced 2026-06-09 04:29:40 +08:00
This commit is contained in:
源文雨
2025-07-16 22:59:58 +09:00
parent 59331ed177
commit 28dca5ac1e
7 changed files with 351 additions and 0 deletions

31
dist.go Normal file
View File

@@ -0,0 +1,31 @@
package main
import (
"archive/zip"
"bytes"
_ "embed"
"fmt"
"io/fs"
"net/http"
)
//go:embed dist.zip
var distzipbytes []byte
var distribution = func() http.FileSystem {
distzip, err := zip.NewReader(bytes.NewReader(distzipbytes), int64(len(distzipbytes)))
if err != nil {
panic(err)
}
return http.FS(fs.FS(distzip))
}()
func init() {
http.Handle("/", http.FileServer(distribution)) // frontend
go func() {
fmt.Println("server quit for", http.ListenAndServe(Endpoint, nil))
}()
fmt.Println("正在展示:", Endpoint)
}