123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #pragma once
- #include <drogon/HttpController.h>
- #include <drogon/drogon.h>
- #include "gsd_InferPlugin.h"
- #include "httpHelper.hpp"
- #include "dataTypeList.h"
- #include <utility>
- using namespace drogon;
- namespace apis
- {
- namespace v1
- {
- class classify : public drogon::HttpController<classify>
- {
- public:
- METHOD_LIST_BEGIN
- // use METHOD_ADD to add your custom processing function here;
- METHOD_ADD(classify::get, "", Get); // path is /apis/v1/classify
-
- METHOD_ADD(classify::PostAnimal, "/animal?result={1}", Post); // path is /apis/v1/classify/{arg1}/{arg2}/list
- METHOD_ADD(classify::PostPersion, "/persion?result={1}", Post);
-
- // ADD_METHOD_TO(classify::your_method_name, "/absolute/path/{1}/{2}/list", Get); // path is /absolute/path/{arg1}/{arg2}/list
- METHOD_LIST_END
- // your declaration of processing function maybe like this:
- void get(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback);
- /**
- * @description: PostAnimal
- * @param {const} HttpRequestPtr
- * @param {function<void (const HttpResponsePtr &)>} &
- * @param {int} result
- * @return {*}
- */
- void PostAnimal(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, int result);
- /**
- * @description: PostPersion
- * @param {const} HttpRequestPtr
- * @param {function<void (const HttpResponsePtr &)>} &
- * @param {int} result
- * @return {*}
- */
- void PostPersion(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, int result);
- // void your_method_name(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, double p1, int p2) const;
- };
- }
- }
|