main.go.tmpl

28 lines
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
package main

import (
	"embed"
	"<<.Module>>/<<.Dir>>/controllers"
	"<<.Module>>/internal/application"
<<- if .WithFrontend>>
	"<<.Module>>/internal/frontend"
	"<<.Module>>/internal/frontend/esbuild"
<<- end>>
)

//go:embed all:views
var views embed.FS

func main() {
	application.Serve(views,
		application.WithValue("theme", "dark"),
		application.WithValue("app_name", "<<.Name>>"),
<<- if .WithFrontend>>
		frontend.WithBundler(&esbuild.Config{
			Entry:   "<<.Dir>>/index.ts",
			Include: []string{"<<.Dir>>/components"},
		}),
<<- end>>
		application.WithController(controllers.Home()),
	)
}