package main import ( websocket "github.com/maddalax/htmgo/extensions/ws" "github.com/maddalax/htmgo/framework/h" "github.com/maddalax/htmgo/framework/service" "io/fs" "net/http" "sse-with-state/__htmgo" ) func main() { locator := service.NewLocator() h.Start(h.AppOpts{ ServiceLocator: locator, LiveReload: true, Register: func(app *h.App) { websocket.EnableExtension(app, websocket.WsExtensionOpts{ WsPath: "/ws", }) sub, err := fs.Sub(GetStaticAssets(), "assets/dist") if err != nil { panic(err) } http.FileServerFS(sub) app.Router.Handle("/public/*", http.StripPrefix("/public", http.FileServerFS(sub))) __htmgo.Register(app.Router) }, }) }