跳转至

Route

The router of auxo web is based on Trie tree. It's fast and zero dynamic memory allocation.

Register

Options

You can attach options to handler when registering routes.

WithName

This option with set the name of handler.

s.Get("/users/:id", getUser, web.WithName("user.get"))

WithAuthorize

This option with set the authorize mode of handler.

s.Get("/login", login, web.WithAuthorize(web.AuthAnonymous))

WithFilter

This option with set the filters of handler.

WithFilterFunc

This option with set the filters of handler with FilterFunc.

WithOption

This option with set the custom option of handler.

s.Get("/login", login, web.WithOption("foo", "bar"))

You can acquire the option through Handler() method of web.Context.

s.Get("/login", func(c web.Context) error {
    opt := c.Handler().Option("foo")
    return c.Text(opt)
})

Group