Files
moloapp/example/main.cpp
T
retoor 3c4334cec9 feat: implement MoloApp plans 01-15 with integration
Full C++23 framework tree: runtime, observability, security,
data, app, realtime, supervisor, clients, CLI, example plus
enterprise tenancy, audit, operability, governance,
supplychain. Postgres via docker compose for tests.
2026-10-23 18:20:04 +02:00

36 lines
900 B
C++

// Living example server entry: serves the demo app on loopback.
// Usage: living-server [port] (default 8080)
#include <chrono>
#include <iostream>
#include <string>
#include <thread>
#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;
}