Function registerHttpSimpleController


#include <lib/inc/drogon/HttpAppFramework.h>

virtual HttpAppFramework & registerHttpSimpleController(const std::string &pathName, const std::string &ctrlName, const std::vector< internal::HttpConstraint > &filtersAndMethods=std::vector< internal::HttpConstraint >{})=0


Register a HttpSimpleController object into the framework.


pathName - When the path of a http request is equal to the pathName, the asyncHandleHttpRequest() method of the controller is called.

ctrlName - is the name of the controller. It includes the namespace to which the controller belongs.

filtersAndMethods - is a vector containing Http methods or filter name constraints.

Example: app.registerHttpSimpleController("/userinfo","UserInfoCtrl",{Get,"LoginFilter"});
Users can perform the same operation through the configuration file or a macro in the header file.


Line 379 in lib/inc/drogon/HttpAppFramework.h.

Add Discussion as Guest

Log in to DocsForge