2018-12-15 12:05:19 +00:00
|
|
|
#include <drogon/drogon.h>
|
|
|
|
|
|
|
|
using namespace drogon;
|
2023-08-23 03:33:30 +00:00
|
|
|
|
2018-12-15 12:05:19 +00:00
|
|
|
int main()
|
|
|
|
{
|
2019-12-23 06:08:56 +00:00
|
|
|
app()
|
|
|
|
.setLogPath("./")
|
2020-01-25 03:58:20 +00:00
|
|
|
.setLogLevel(trantor::Logger::kWarn)
|
2019-12-23 06:08:56 +00:00
|
|
|
.addListener("0.0.0.0", 7770)
|
|
|
|
.setThreadNum(0)
|
|
|
|
.registerSyncAdvice([](const HttpRequestPtr &req) -> HttpResponsePtr {
|
|
|
|
const auto &path = req->path();
|
|
|
|
if (path.length() == 1 && path[0] == '/')
|
|
|
|
{
|
|
|
|
auto response = HttpResponse::newHttpResponse();
|
|
|
|
response->setBody("<p>Hello, world!</p>");
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
})
|
|
|
|
.run();
|
|
|
|
}
|