-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cc
24 lines (23 loc) · 980 Bytes
/
main.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <drogon/HttpAppFramework.h>
#include <drogon/utils/FunctionTraits.h>
int main() {
std::cout << " _\n"
<< " __| |_ __ ___ __ _ ___ _ __\n"
<< " / _` | '__/ _ \\ / _` |/ _ \\| '_ \\\n"
<< "| (_| | | | (_) | (_| | (_) | | | |\n"
<< " \\__,_|_| \\___/ \\__, |\\___/|_| |_|\n"
<< " |___/" << std::endl;
std::cout << "Drogon version: " << drogon::getVersion() << std::endl;
// Set HTTP listener address and port
drogon::app().addListener("0.0.0.0", 80);
// Load config file
drogon::app().loadConfigFile("../config.json");
drogon::app().registerPostHandlingAdvice(
[](const drogon::HttpRequestPtr &req,
const drogon::HttpResponsePtr &resp) {
resp->addHeader("Access-Control-Allow-Origin", "*");
});
// Run HTTP framework,the method will block in the internal event loop
drogon::app().run();
return 0;
}