Closed
Description
From the documentation it seems LocalDir
is intended to allow you to specify some directory on the local filesystem to serve under web/
for static assets. There is an example for this showing /tmp/web
as an example destination but this does not seem to work. Here's my main.go
:
package main
import (
"log"
"net/http"
"github.com/maxence-charriere/go-app/v9/pkg/app"
)
type hello struct {
app.Compo
}
func (h *hello) Render() app.UI {
return app.H1().Text("Hello World!")
}
func main() {
app.Route("/", &hello{})
app.RunWhenOnBrowser()
http.Handle("/", &app.Handler{
Name: "Hello",
Description: "An Hello World! example",
Resources: app.LocalDir("/tmp/goappweb"),
})
if err := http.ListenAndServe(":8000", nil); err != nil {
log.Fatal(err)
}
}
I ran the following to build the app:
mkdir -p /tmp/goappweb
GOARCH=wasm GOOS=js go build -o /tmp/goappweb/app.wasm .
Metadata
Metadata
Assignees
Labels
No labels