All the pages are working again, but Alpine is insanely frustrating.

This commit is contained in:
Zed A. Shaw 2025-08-02 13:56:39 -04:00
parent 81cf5e0d93
commit 7125bc2d2a
15 changed files with 95 additions and 40 deletions

View file

@ -110,6 +110,21 @@ func PostApiLink(c *fiber.Ctx) error {
return c.Redirect("/live/")
}
func GetApiGame(c *fiber.Ctx) error {
sql, args, err := sq.Select("*").From("game").ToSql()
err = data.SelectJson[data.Game](c, err, sql, args...)
return IfErrNil(err, c)
}
func GetApiGameId(c *fiber.Ctx) error {
sql, args, err := sq.Select("*").
From("game").Where(sq.Eq{"id": c.Params("id")}).ToSql()
err = data.GetJson[data.Game](c, err, sql, args...)
return IfErrNil(err, c)
}
func Setup(app *fiber.App) {
STORE = session.New()
@ -120,7 +135,11 @@ func Setup(app *fiber.App) {
})
app.Get("/stream/:id/", Page("stream"))
app.Get("/game/:id/:name/", Page("game"))
app.Get("/game/:id/:slug/", Page("game"))
app.Get("/api/game", GetApiGame)
app.Get("/api/game/:id", GetApiGameId)
app.Get("/api/stream", GetApiStream)
app.Get("/api/logout", GetApiLogout)
app.Get("/api/stream/:id", GetApiStreamId)