drogon/examples/simple_example/TestController.h

29 lines
805 B
C
Raw Normal View History

2018-05-14 08:57:40 +00:00
#pragma once
#include <drogon/HttpSimpleController.h>
#include <drogon/IOThreadStorage.h>
2018-05-14 08:57:40 +00:00
using namespace drogon;
2018-10-14 07:56:54 +00:00
namespace example
{
class TestController : public drogon::HttpSimpleController<TestController>
{
2019-01-02 10:49:37 +00:00
public:
2019-05-18 12:39:57 +00:00
virtual void asyncHandleHttpRequest(
const HttpRequestPtr &req,
std::function<void(const HttpResponsePtr &)> &&callback) override;
2019-01-02 10:49:37 +00:00
PATH_LIST_BEGIN
2019-05-18 12:39:57 +00:00
// list path definations here;
// PATH_ADD("/path","filter1","filter2",...);
2019-04-12 13:45:43 +00:00
PATH_ADD("/", Get);
2019-01-02 10:49:37 +00:00
PATH_ADD("/Test", "nonFilter");
2019-04-12 13:45:43 +00:00
PATH_ADD("/tpost", Post, Options);
2019-01-02 10:49:37 +00:00
PATH_ADD("/slow", "TimeFilter", Get);
PATH_LIST_END
2019-01-25 08:46:20 +00:00
TestController()
{
LOG_DEBUG << "TestController constructor";
}
private:
drogon::IOThreadStorage<int> _threadIndex;
2018-10-14 07:56:54 +00:00
};
2019-05-18 12:39:57 +00:00
} // namespace example