apis_v1_classify.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #pragma once
  2. #include <drogon/HttpController.h>
  3. #include <drogon/drogon.h>
  4. #include "gsd_InferPlugin.h"
  5. #include "httpHelper.hpp"
  6. #include "dataTypeList.h"
  7. #include <utility>
  8. using namespace drogon;
  9. namespace apis
  10. {
  11. namespace v1
  12. {
  13. class classify : public drogon::HttpController<classify>
  14. {
  15. public:
  16. METHOD_LIST_BEGIN
  17. // use METHOD_ADD to add your custom processing function here;
  18. METHOD_ADD(classify::get, "", Get); // path is /apis/v1/classify
  19. METHOD_ADD(classify::PostAnimal, "/animal?result={1}", Post); // path is /apis/v1/classify/{arg1}/{arg2}/list
  20. METHOD_ADD(classify::PostPersion, "/persion?result={1}", Post);
  21. // ADD_METHOD_TO(classify::your_method_name, "/absolute/path/{1}/{2}/list", Get); // path is /absolute/path/{arg1}/{arg2}/list
  22. METHOD_LIST_END
  23. // your declaration of processing function maybe like this:
  24. void get(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback);
  25. /**
  26. * @description: PostAnimal
  27. * @param {const} HttpRequestPtr
  28. * @param {function<void (const HttpResponsePtr &)>} &
  29. * @param {int} result
  30. * @return {*}
  31. */
  32. void PostAnimal(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, int result);
  33. /**
  34. * @description: PostPersion
  35. * @param {const} HttpRequestPtr
  36. * @param {function<void (const HttpResponsePtr &)>} &
  37. * @param {int} result
  38. * @return {*}
  39. */
  40. void PostPersion(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, int result);
  41. // void your_method_name(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, double p1, int p2) const;
  42. };
  43. }
  44. }