Method

CogPrefixRoutesHandlermount_path

Declaration [src]

gboolean
cog_prefix_routes_handler_mount_path (
  CogPrefixRoutesHandler* self,
  const char* path_prefix,
  const char* base_path
)

Description [src]

Adds a route to the handler pointing to a directory.

This is a utility method which configures a route matching path_prefix in URI paths, and creates a new CogDirectoryFilesHandler for base_path to handle requests for the route. 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.
base_path

Type: const char*

Path to a local directory.

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

Return value

Type: gboolean

Whether the route was successfully added.