Router

You can define your own routes using Router.

Routes (a.k.a. mux, handlers) are a way to map from a URL path to some code which is executed when an end-user accesses that path.

Registering HTTP routes

First, get router from QOR Admin...

router := Admin.GetRouter()

General routes

router.Get("/path", func(context *admin.Context) {
    // do something here
})

router.Post("/path", func(context *admin.Context) {
    // do something here
})

router.Put("/path", func(context *admin.Context) {
    // do something here
})

router.Delete("/path", func(context *admin.Context) {
    // do something here
})

Naming route

router.Get("/path/:name", func(context *admin.Context) {
    context.Request.URL.Query().Get(":name")
})

Regexp support

router.Get("/path/:name[world]", func(context *admin.Context) { // "/hello/world"
    context.Request.URL.Query().Get(":name")
})

router.Get("/path/:name[\\d+]", func(context *admin.Context) { // "/hello/123"
    context.Request.URL.Query().Get(":name")
})

results matching ""

    No results matching ""