Method

Cog.PrefixRoutesHandler.mount_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 const char*
 

URI path prefix to match

 Ownership is not transferred to the callee
 The string is a NUL terminated UTF-8 string
base_path const char*
 

Path to a local directory

 Ownership is not transferred to the callee
 The string is a NUL terminated UTF-8 string

Return value

Returns: gboolean

Whether the route was successfully added.