-
Notifications
You must be signed in to change notification settings - Fork 0
How to extended it
Henrique Rocha edited this page Aug 25, 2021
·
1 revision
Add another field to the enum e_uri on enki.h file:
enum e_uri
{
HOME_ROUTE,
DOCS_ROUTE,
DOCS_ROUTE_,
API_BASE_ROUTE,
API_BASE_ROUTE_,
API_MAIN_ROUTE,
API_EXAMPLE
};Add another else if statement in the function get_uri on router.c as follows:
else if (mg_http_match_uri(request, "/example"))
return (API_EXAMPLE);Then edit the function handle_routes on router.c as follows:
Add an else if with your route, method and reply.
else if (uri == API_EXAMPLE && method == GET)
mg_http_reply(c, 200, "", "EXAMPLE");It’s done!