package routes

import (
	"fmt"
	"net/http"

	"sour.is/x/toolbox/httpsrv"
)

func init() {
	asset := assetFS()
	fmt.Printf("%#v\n", asset)

	httpsrv.HttpRegister("ui", httpsrv.HttpRoutes{
		{
			Name:        "Assets",
			Method:      "GET",
			Pattern:     "/ui{path:.*}",
			HandlerFunc: http.StripPrefix("/ui", http.FileServer(httpsrv.FsHtml5(asset))).ServeHTTP,
		},

		{Name: "Root", Method: "GET", Pattern: "/", HandlerFunc: http.RedirectHandler("/ui/", http.StatusFound).ServeHTTP},
	})
}

//go:generate go run github.com/sour-is/go-assetfs/cmd/assetfs -pkg routes  -prefix ../../ ../../public/...
