htmgo/templates/starter/main.go

33 lines
543 B
Go
Raw Normal View History

2024-09-23 15:57:59 +00:00
package main
import (
"embed"
"github.com/labstack/echo/v4"
2024-09-23 15:57:59 +00:00
"github.com/maddalax/htmgo/framework/h"
"github.com/maddalax/htmgo/framework/service"
"io/fs"
"starter-template/__htmgo"
)
//go:embed assets/dist/*
var StaticAssets embed.FS
func main() {
locator := service.NewLocator()
sub, err := fs.Sub(StaticAssets, "assets/dist")
if err != nil {
panic(err)
}
2024-09-23 15:57:59 +00:00
h.Start(h.AppOpts{
ServiceLocator: locator,
LiveReload: true,
Register: func(e *echo.Echo) {
e.StaticFS("/public", sub)
__htmgo.Register(e)
2024-09-23 15:57:59 +00:00
},
})
}