//go:build ignore
// +build ignore
package main
import (
"io"
"log"
"net/http"
"os"
"github.com/vugu/vugu/devutil"
)
func main() {
l := "127.0.0.1:8844"
log.Printf("Starting HTTP Server at %q", l)
wc := devutil.NewWasmCompiler().SetDir(".")
mux := devutil.NewMux()
index_file, err := os.Open("../index.html")
if err != nil {
log.Fatal(err.Error())
}
defer index_file.Close()
index_content, err := io.ReadAll(index_file)
if err != nil {
log.Fatal(err.Error())
}
mux.Match(devutil.NoFileExt, devutil.StaticContent(string(index_content)))
mux.Exact("/main.wasm", devutil.NewMainWasmHandler(wc))
mux.Exact("/wasm_exec.js", devutil.NewWasmExecJSHandler(wc))
mux.Default(devutil.NewFileServer().SetDir("../dist"))
log.Fatal(http.ListenAndServe(l, mux))
}