Created a common.Page function that returns a function to render a page from a view.
This commit is contained in:
parent
1bd733c328
commit
e4153fd74a
1 changed files with 2 additions and 10 deletions
|
@ -23,14 +23,6 @@ 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...)
|
||||
|
@ -127,8 +119,8 @@ func Setup(app *fiber.App) {
|
|||
CacheDuration: 1 * time.Nanosecond,
|
||||
})
|
||||
|
||||
app.Get("/stream/:id/", GetPageStream)
|
||||
app.Get("/game/:id/:name/", GetPageGame)
|
||||
app.Get("/stream/:id/", Page("stream"))
|
||||
app.Get("/game/:id/:name/", Page("game"))
|
||||
app.Get("/api/stream", GetApiStream)
|
||||
app.Get("/api/logout", GetApiLogout)
|
||||
app.Get("/api/stream/:id", GetApiStreamId)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue