Method

CogPrefixRoutesHandlermount

Declaration [src]

gboolean
cog_prefix_routes_handler_mount (
  CogPrefixRoutesHandler* self,
  const char* path_prefix,
  CogRequestHandler* handler
)

Description [src]

Adds a route to the handler.

Configures a route which matches path_prefix in URI paths, and dispatches requests to a given handler. The path_prefix must contain a leading slash character (/).

Parameters

path_prefix

Type: const char*

URI path prefix to match.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
handler

Type: CogRequestHandler

A request handler for the matched prefix.

The data is owned by the caller of the function.

Return value

Type: gboolean

Whether the route was successfully added.