// Living example server entry: serves the demo app on loopback. // Usage: living-server [port] (default 8080) #include #include #include #include #include "app/App.hpp" #include "fw/Server.hpp" int main(int argc, char** argv) { int port = 8080; if (argc > 1) { try { port = std::stoi(argv[1]); } catch (...) { std::cerr << "bad port\n"; return 1; } } molo::example::app::Services services; auto app = molo::example::app::build_application(services); molo::example::fw::Server server(app); if (!server.start("127.0.0.1", port)) { std::cerr << "bind failed\n"; return 1; } std::cout << "living example on http://127.0.0.1:" << server.port() << "\n"; std::cout << "press Ctrl-C to stop\n"; while (server.running()) { std::this_thread::sleep_for(std::chrono::milliseconds(200)); } return 0; }