package main import ( "embed" "github.com/maddalax/htmgo/framework/h" "github.com/maddalax/htmgo/framework/service" _ "github.com/mattn/go-sqlite3" "io/fs" "net/http" "todolist/__htmgo" "todolist/ent" "todolist/infrastructure/db" ) //go:embed assets/dist/* var StaticAssets embed.FS func main() { locator := service.NewLocator() service.Set[ent.Client](locator, service.Singleton, func() *ent.Client { return db.Provide() }) h.Start(h.AppOpts{ ServiceLocator: locator, LiveReload: true, Register: func(app *h.App) { sub, err := fs.Sub(StaticAssets, "assets/dist") if err != nil { panic(err) } http.FileServerFS(sub) app.Router.Handle("/public/*", http.StripPrefix("/public", http.FileServerFS(sub))) __htmgo.Register(app.Router) }, }) }