fix a spelling error

This commit is contained in:
an-tao 2018-06-07 16:38:45 +08:00
parent 5728774b26
commit 132e887337
4 changed files with 10 additions and 15 deletions

View File

@ -240,5 +240,5 @@ void create_controller::newApiControllerSourceFile(std::ofstream &file,const std
class_name=className.substr(pos+2);
}
file<<"//add defination of your processing function here\n";
file<<"//add definition of your processing function here\n";
}

2
examples/static_link_example/api_v1_ApiTest.cc Normal file → Executable file
View File

@ -1,6 +1,6 @@
#include "api_v1_ApiTest.h"
using namespace api::v1;
//add defination of your processing function here
//add definition of your processing function here
void ApiTest::get(const HttpRequest& req,const std::function<void (HttpResponse &)>&callback,int p1,std::string p2)
{
HttpViewData data;

View File

@ -13,10 +13,6 @@ public:
const std::function<void (HttpResponse &)>&callback,
int p1,const std::string &p2,const std::string &p3,int p4) const
{
LOG_DEBUG<<"int p1="<<p1;
LOG_DEBUG<<"string p2="<<p2;
LOG_DEBUG<<"string p3="<<p3;
LOG_DEBUG<<"int p4="<<p4;
HttpViewData data;
data.insert("title",std::string("ApiTest::get"));
std::map<std::string,std::string> para;
@ -35,8 +31,6 @@ class B
public:
void operator ()(const HttpRequest& req,const std::function<void (HttpResponse &)>&callback,int p1,int p2)
{
LOG_DEBUG<<"int p1="<<p1;
LOG_DEBUG<<"int p2="<<p2;
HttpViewData data;
data.insert("title",std::string("ApiTest::get"));
std::map<std::string,std::string> para;
@ -59,8 +53,6 @@ namespace api
METHOD_LIST_END
void get(const HttpRequest& req,const std::function<void (HttpResponse &)>&callback,int p1,int p2) const
{
LOG_DEBUG<<"int p1="<<p1;
LOG_DEBUG<<"int p2="<<p2;
HttpViewData data;
data.insert("title",std::string("ApiTest::get"));
std::map<std::string,std::string> para;
@ -72,10 +64,6 @@ namespace api
}
void list(const HttpRequest& req,const std::function<void (HttpResponse &)>&callback,int p1,int p2) const
{
LOG_DEBUG<<"int p1="<<p1;
LOG_DEBUG<<"int p2="<<p2;
LOG_DEBUG<<"int p1="<<p1;
LOG_DEBUG<<"int p2="<<p2;
HttpViewData data;
data.insert("title",std::string("ApiTest::get"));
std::map<std::string,std::string> para;

View File

@ -63,7 +63,14 @@ namespace drogon
{
path.replace(pos,2,"/");
}
HttpAppFramework::registerHttpApiMethod(path+pattern,std::forward<FUNCTION>(function),filters);
if(pattern[0]=='/')
HttpAppFramework::registerHttpApiMethod(path+pattern,
std::forward<FUNCTION>(function),
filters);
else
HttpAppFramework::registerHttpApiMethod(path+"/"+pattern,
std::forward<FUNCTION>(function),
filters);
}
private: