Now can alternatively generate a static page for a URL from pages, or dynamically return it with c.Render from views. Did this for games and streams.

This commit is contained in:
Zed A. Shaw 2025-07-10 11:46:56 -04:00
parent cb537328ff
commit d095bc9ff4
6 changed files with 45 additions and 94 deletions

View file

@ -22,6 +22,14 @@ func GetApiLogout(c *fiber.Ctx) error {
return c.Redirect("/")
}
func GetPageStream(c *fiber.Ctx) error {
return c.Render("stream", fiber.Map{})
}
func GetPageGame(c *fiber.Ctx) error {
return c.Render("game", fiber.Map{})
}
func GetApiStream(c *fiber.Ctx) error {
sql, args, err := sq.Select("*").From("stream").ToSql()
err = data.SelectJson[data.Stream](c, err, sql, args...)
@ -118,6 +126,8 @@ func Setup(app *fiber.App) {
CacheDuration: 1 * time.Nanosecond,
})
app.Get("/stream/:id/", GetPageStream)
app.Get("/game/:id/:name/", GetPageGame)
app.Get("/api/stream", GetApiStream)
app.Get("/api/logout", GetApiLogout)
app.Get("/api/stream/:id", GetApiStreamId)