blt/web/routes.go
2024-05-29 08:42:53 -04:00

43 lines
974 B
Go

package web
import (
"github.com/flamego/binding"
"github.com/flamego/flamego"
"git.metaunix.net/bitgoblin/blt/web/forms"
"git.metaunix.net/bitgoblin/blt/web/routes"
)
func RegisterRoutes(f *flamego.Flame) {
// index routes
f.Get("/", routes.GetDashboard)
// hardware routes
f.Group("/hardware", func() {
f.Get("", func(c flamego.Context) {
c.Redirect("/hardware/list")
})
f.Get("/list", routes.HardwareGetList)
f.Get("/create", routes.HardwareGetCreate)
f.Post("/create", binding.Form(forms.HardwareForm{}), routes.HardwarePostCreate)
f.Get("/{hardware_id}", routes.HardwareGetView)
})
// test routes
f.Group("/test", func() {
f.Get("", func(c flamego.Context) {
c.Redirect("/test/list")
})
f.Get("/list", routes.TestGetList)
f.Get("/create", routes.TestGetCreate)
f.Post("/create", binding.Form(forms.TestForm{}), routes.TestPostCreate)
f.Get("{test_id}", routes.TestGetView)
})
}