1
0
mirror of https://github.com/fumiama/go-web-wrapper.git synced 2026-06-05 00:32:43 +08:00
Files
go-web-wrapper/dist.go
源文雨 28dca5ac1e init
2025-07-16 22:59:58 +09:00

32 lines
542 B
Go

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)
}