CppRestApi Routing

Admin私のストア

In CppRestApi, set a RestAPI class that implements the get, put, post, and del methods to api.

map<string, RestApi> api;

api.insert(api_name, rest_api);

For each configured API, add the API's get, put, post, and del methods to the http_listener of cpprestspa.

map<string, http_listener> listener;

listener.insert(api_name, http_listener{url});

listener.at(api_name).support(<GET|PUT|POST|DEL>, rest_api.<get|put|post|del>);

In the actual implementation, rest_api is not registered directly, but is executed via the getAPI method (handler), which first processes the access method of the Auth class.

The getAPI handler calls the requested API if access is allowed.

If not possible, call the login_api get method.

To add your own RestAPI class, configure permission management and then register the api name and RestAPI class in api.insert.

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.