Skip to main content

ClikaRT::http::RouteGroup

class

Header: ClikaRT/http/server.h

A handle for registering routes under a shared path prefix + middleware chain. Valid only while its HttpServer is alive and not yet serving.

Exact-path routes (this group)​

get()​

void get(std::string_view path, Handler handler)

Declared in ClikaRT/http/server.h, line 427

post()​

void post(std::string_view path, Handler handler)

POST.

Declared in ClikaRT/http/server.h, line 430

put()​

void put(std::string_view path, Handler handler)

PUT.

Declared in ClikaRT/http/server.h, line 433

patch()​

void patch(std::string_view path, Handler handler)

PATCH.

Declared in ClikaRT/http/server.h, line 436

del()​

void del(std::string_view path, Handler handler)

DELETE (named del; delete is a C++ keyword).

Declared in ClikaRT/http/server.h, line 439

void head(std::string_view path, Handler handler)

HEAD (an unrouted HEAD falls back to the matching GET handler).

Declared in ClikaRT/http/server.h, line 442

options()​

void options(std::string_view path, Handler handler)

OPTIONS.

Declared in ClikaRT/http/server.h, line 445

Member functions​

RouteGroup()​

RouteGroup(RouteGroup&&) noexcept

Move-only: transfers the group handle.

Declared in ClikaRT/http/server.h, line 405

operator=()​

RouteGroup& operator=(RouteGroup&&) noexcept

Move-assign: transfers the group handle.

Declared in ClikaRT/http/server.h, line 407

~RouteGroup()​

~RouteGroup()

Releases the group handle.

Declared in ClikaRT/http/server.h, line 409

group()​

RouteGroup group(std::string_view prefix)

A nested group; prefix + middleware compose with this group's.

Declared in ClikaRT/http/server.h, line 412

use()​

RouteGroup& use(Middleware middleware) &

Middleware applied to every route in this group (chainable). A throw from the middleware is contained caller-side (see detail::contain).

Declared in ClikaRT/http/server.h, line 415

route()​

void route(
    Method method,
    std::string_view pattern,
    Handler handler
)

re2-pattern route (positional + named captures, read in the handler via ServerRequest::param). Same containment and registration contract as the exact-path group.

Throws

  • ClikaRT::Error: when the pattern or registration is rejected.

Declared in ClikaRT/http/server.h, line 452