blt/web/routes.go

62 lines
1.4 KiB
Go
Raw Normal View History

package web
import (
2023-11-28 16:36:11 -05:00
"github.com/flamego/binding"
"github.com/flamego/flamego"
2023-11-28 16:36:11 -05:00
"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)
2023-12-02 22:37:46 -05:00
// 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)
2024-05-29 08:37:51 -04:00
f.Get("/{hardware_id}", routes.HardwareGetView)
2023-12-02 22:37:46 -05:00
})
2024-05-29 09:11:13 -04:00
// benchmark routes
f.Group("/benchmark", func() {
f.Get("", func(c flamego.Context) {
c.Redirect("/benchmark/list")
})
f.Get("/list", routes.BenchmarkGetList)
f.Get("/create", routes.BenchmarkGetCreate)
f.Post("/create", binding.Form(forms.BenchmarkForm{}), routes.BenchmarkPostCreate)
f.Get("/{benchmark_id}", routes.BenchmarkGetView)
})
2023-12-02 22:16:16 -05:00
// test routes
f.Group("/test", func() {
f.Get("", func(c flamego.Context) {
2023-12-02 22:16:16 -05:00
c.Redirect("/test/list")
})
2023-12-02 22:16:16 -05:00
f.Get("/list", routes.TestGetList)
2023-12-02 22:16:16 -05:00
f.Get("/create", routes.TestGetCreate)
f.Post("/create", binding.Form(forms.TestForm{}), routes.TestPostCreate)
2024-05-29 08:42:53 -04:00
2024-05-29 09:19:53 -04:00
f.Get("/{test_id}", routes.TestGetView)
})
2024-05-29 11:40:42 -04:00
// result routes
f.Group("/result", func() {
f.Post("/add", routes.ResultPostCreate)
})
}