package main import ( inertia "github.com/romsar/gonertia" "log" "net/http" ) func main() { i, err := inertia.NewFromFile("./root.html") if err != nil { log.Fatal(err) } mux := http.NewServeMux() mux.Handle("/", i.Middleware(homeHandler(i))) mux.Handle("/build/", http.StripPrefix("/build/", http.FileServer(http.Dir("./serve/build")))) http.ListenAndServe(":8080", mux) } func homeHandler(i *inertia.Inertia) http.Handler { fn := func(w http.ResponseWriter, r *http.Request) { err := i.Render(w, r, "Home/Index", inertia.Props{ "text": "From Golang", }) if err != nil { return } } return http.HandlerFunc(fn) }