29 lines
1.3 KiB
Plaintext
29 lines
1.3 KiB
Plaintext
mg_set_request_handler(ctx,
|
|
"/form",
|
|
FileHandler,
|
|
(void *)"../../test/form.html");
|
|
|
|
mg_set_request_handler(ctx, EXAMPLE_URI, ExampleHandler, 0);
|
|
mg_set_request_handler(ctx, EXIT_URI, ExitHandler, 0);
|
|
|
|
/* mg_set_request_handler
|
|
Sets or removes a URI mapping for a request handler.
|
|
This function uses mg_lock_context internally.
|
|
URI's are ordered and prefixed URI's are supported. For example,
|
|
consider two URIs: /a/b and /a
|
|
/a matches /a
|
|
/a/b matches /a/b
|
|
/a/c matches /a
|
|
Parameters:
|
|
ctx: server context
|
|
uri: the URI (exact or pattern) for the handler
|
|
handler: the callback handler to use when the URI is requested.
|
|
If NULL, an already registered handler for this URI will
|
|
be removed.
|
|
The URI used to remove a handler must match exactly the
|
|
one used to register it (not only a pattern match).
|
|
cbdata: the callback data to give to the handler when it is called. */
|
|
CIVETWEB_API void mg_set_request_handler(struct mg_context *ctx,
|
|
const char *uri,
|
|
mg_request_handler handler,
|
|
void *cbdata); |