2018-09-07 01:53:37 +00:00
|
|
|
#pragma once
|
2018-11-15 06:31:10 +00:00
|
|
|
#include <drogon/HttpController.h>
|
2018-09-07 01:53:37 +00:00
|
|
|
using namespace drogon;
|
|
|
|
namespace api
|
|
|
|
{
|
2018-11-15 06:31:10 +00:00
|
|
|
class Attachment : public drogon::HttpController<Attachment>
|
2018-10-14 07:56:54 +00:00
|
|
|
{
|
2019-01-02 10:49:37 +00:00
|
|
|
public:
|
|
|
|
METHOD_LIST_BEGIN
|
|
|
|
//use METHOD_ADD to add your custom processing function here;
|
2019-03-06 07:57:05 +00:00
|
|
|
METHOD_ADD(Attachment::get, "", Get); //Path is '/api/attachment'
|
2019-01-02 10:49:37 +00:00
|
|
|
METHOD_ADD(Attachment::upload, "/upload", Post);
|
2019-01-28 10:25:04 +00:00
|
|
|
METHOD_ADD(Attachment::download, "/download", Get);
|
2019-01-02 10:49:37 +00:00
|
|
|
METHOD_LIST_END
|
|
|
|
//your declaration of processing function maybe like this:
|
|
|
|
void get(const HttpRequestPtr &req,
|
|
|
|
const std::function<void(const HttpResponsePtr &)> &callback);
|
|
|
|
void upload(const HttpRequestPtr &req,
|
|
|
|
const std::function<void(const HttpResponsePtr &)> &callback);
|
2019-01-28 10:25:04 +00:00
|
|
|
void download(const HttpRequestPtr &req,
|
|
|
|
const std::function<void(const HttpResponsePtr &)> &callback);
|
2018-10-14 07:56:54 +00:00
|
|
|
};
|
|
|
|
} // namespace api
|