This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
2022-01-18 11:37:00 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"embed"
|
|
|
|
"fmt"
|
|
|
|
"io/fs"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2023-10-30 16:35:30 +00:00
|
|
|
//go:embed assets/index.html assets/main.wasm assets/wasm_exec.js
|
2022-01-18 11:37:00 +00:00
|
|
|
assetsFolder embed.FS
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
f, err := fs.Sub(assetsFolder, "assets")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
fmt.Println("Opening server on http://localhost:8080")
|
|
|
|
err = http.ListenAndServe(":8080", http.StripPrefix("/", http.FileServer(http.FS(f))))
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("Failed to start server", err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|