-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathMain.cpp
25 lines (23 loc) · 940 Bytes
/
Main.cpp
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 <seastar/core/app-template.hh>
#include <CPVFramework/Application/Application.hpp>
#include <CPVFramework/Application/Modules/LoggingModule.hpp>
#include <CPVFramework/Application/Modules/HttpServerModule.hpp>
#include <CPVFramework/Application/Modules/HttpServerRoutingModule.hpp>
#include <CPVFramework/Http/HttpResponseExtensions.hpp>
int main(int argc, char** argv) {
seastar::app_template app;
app.run(argc, argv, [] {
cpv::Application application;
application.add<cpv::LoggingModule>();
application.add<cpv::HttpServerModule>([] (auto& module) {
module.getConfig().setListenAddresses({ "0.0.0.0:8000", "127.0.0.1:8001" });
});
application.add<cpv::HttpServerRoutingModule>([] (auto& module) {
module.route(cpv::constants::GET, "/", [] (cpv::HttpContext& context) {
return cpv::extensions::reply(context.getResponse(), "Hello World!");
});
});
return application.runForever();
});
return 0;
}