Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 0b7dbea

Browse files
committed
feat: add prelight
1 parent 627a597 commit 0b7dbea

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

controllers/prelight.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#include "prelight.h"
2+
3+
// Add definition of your processing function here

controllers/prelight.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#pragma once
2+
3+
#include <drogon/HttpController.h>
4+
5+
using namespace drogon;
6+
7+
class prelight : public drogon::HttpController<prelight>
8+
{
9+
public:
10+
METHOD_LIST_BEGIN
11+
// use METHOD_ADD to add your custom processing function here;
12+
// METHOD_ADD(prelight::get, "/{2}/{1}", Get); // path is /prelight/{arg2}/{arg1}
13+
// METHOD_ADD(prelight::your_method_name, "/{1}/{2}/list", Get); // path is /prelight/{arg1}/{arg2}/list
14+
// ADD_METHOD_TO(prelight::your_method_name, "/absolute/path/{1}/{2}/list", Get); // path is /absolute/path/{arg1}/{arg2}/list
15+
16+
METHOD_LIST_END
17+
// your declaration of processing function maybe like this:
18+
// void get(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, int p1, std::string p2);
19+
// void your_method_name(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, double p1, int p2) const;
20+
};

0 commit comments

Comments
 (0)