drogon/examples/simple_example/CustomCtrl.h

26 lines
707 B
C
Raw Normal View History

#pragma once
#include <drogon/HttpController.h>
using namespace drogon;
class CustomCtrl : public drogon::HttpController<CustomCtrl, false>
{
public:
METHOD_LIST_BEGIN
2019-05-18 12:39:57 +00:00
// use METHOD_ADD to add your custom processing function here;
METHOD_ADD(CustomCtrl::hello,
"/{1}",
Get,
"CustomHeaderFilter"); // path is /customctrl/{arg1}
METHOD_LIST_END
2019-05-18 12:39:57 +00:00
explicit CustomCtrl(const std::string &greetings) : _greetings(greetings)
{
}
2019-05-18 12:39:57 +00:00
void hello(const HttpRequestPtr &req,
std::function<void(const HttpResponsePtr &)> &&callback,
const std::string &userName) const;
private:
std::string _greetings;
};