drogon/examples/simple_example/api_v1_ApiTest.h

23 lines
972 B
C
Raw Normal View History

#pragma once
#include <drogon/HttpApiController.h>
using namespace drogon;
namespace api
{
namespace v1
{
class ApiTest:public drogon::HttpApiController<ApiTest>
{
2018-08-14 08:35:05 +00:00
public:
METHOD_LIST_BEGIN
//use METHOD_ADD to add your custom processing function here;
2018-08-30 02:18:04 +00:00
METHOD_ADD(ApiTest::get,"/get/{2}/{1}","drogon::GetFilter");//path will be /api/v1/ApiTest/get/{arg2}/{arg1}
METHOD_ADD(ApiTest::your_method_name,"/{1}/list?p2={2}","drogon::GetFilter");//path will be /api/v1/ApiTest/{arg1}/list
2018-08-14 08:35:05 +00:00
METHOD_LIST_END
//your declaration of processing function maybe like this:
2018-08-29 10:26:36 +00:00
void get(const HttpRequestPtr& req,const std::function<void (const HttpResponsePtr &)>&callback,int p1,std::string &&p2);
2018-08-26 08:25:35 +00:00
void your_method_name(const HttpRequestPtr& req,const std::function<void (const HttpResponsePtr &)>&callback,double p1,int p2) const;
};
}
}