main.go
go
package main
import (
	"embed"
	"io/fs"
	"log"
	"net/http"
	"os"
	"theskyscape.com/repo/skykit"
)
//go:embed all:views
var views embed.FS
func main() {
	app := skykit.New(views)
	skykit.WithValue("host", os.Getenv("HOST_PREFIX"))(app)
	skykit.WithValue("theme", "forest")(app)
	skykit.WithFunc("gallery", gallery)(app)
	http.Handle("GET /", app.Serve("homepage.html", nil))
	http.Handle("GET /gallery", app.Serve("gallery.html", nil))
	if _, err := fs.Sub(views, "views/public"); err == nil {
		public, _ := fs.Sub(views, "views")
		http.Handle("GET /public/", http.FileServerFS(public))
	}
	if err := app.Start(); err != nil {
		log.Fatal(err)
	}
}
No comments yet.