A small project that collects various nice things to get started with Go Web Development.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

28 lines
721 B

package admin_table
import (
"github.com/gofiber/fiber/v2"
. "MY/webapp/common"
)
func GetPageSelectOne(c *fiber.Ctx) error {
_, err := AuthCheck(c, true)
if err != nil { return c.Redirect("/") }
table := c.Params("table")
id, err := c.ParamsInt("id", -1)
if err != nil || id < 0 { return IfErrNil(err, c) }
return c.Render("admin/table/view", fiber.Map{
"table": table,
"id": id,
})
}
func SetupPages(app *fiber.App) {
AddAuthedPage(app, true, "admin/table/", "admin/table/index")
AddAuthedPage(app, true, "admin/table/:table/", "admin/table/contents")
AddAuthedPage(app, true, "admin/table/new/:table/", "admin/table/new")
app.Get("/admin/table/:table/:id/", GetPageSelectOne)
}