Files
moloapp/example/app/App.hpp
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

70 lines
2.8 KiB
C++

#pragma once
// Demo application assembly: shared Services (the DI skeleton), the root
// Application with middleware, routers, and mounted sub-applications.
// Gap: real molo::di::Container and plugin registry in 05-request-routing.md.
#include <map>
#include <memory>
#include <string>
#include "../fw/App.hpp"
#include "../fw/Data.hpp"
#include "../fw/Jobs.hpp"
#include "../fw/Kv.hpp"
#include "../fw/Net.hpp"
#include "../fw/Observ.hpp"
#include "../fw/Templates.hpp"
namespace molo::example::app {
struct Services {
std::shared_ptr<fw::KvStore> kv = std::make_shared<fw::KvStore>();
std::shared_ptr<fw::Cache> cache = std::make_shared<fw::Cache>();
std::shared_ptr<fw::Pubsub> pubsub = std::make_shared<fw::Pubsub>();
std::shared_ptr<fw::EventBus> events = std::make_shared<fw::EventBus>();
std::shared_ptr<fw::Metrics> metrics = std::make_shared<fw::Metrics>();
std::shared_ptr<fw::Telemetry> telemetry =
std::make_shared<fw::Telemetry>();
std::shared_ptr<fw::SessionStore> sessions =
std::make_shared<fw::SessionStore>();
std::shared_ptr<fw::Auth> auth = std::make_shared<fw::Auth>();
std::shared_ptr<fw::OrmDb> sqlite =
std::make_shared<fw::OrmDb>(fw::OrmBackend::Sqlite);
std::shared_ptr<fw::OrmDb> postgres =
std::make_shared<fw::OrmDb>(fw::OrmBackend::Postgres);
std::shared_ptr<fw::UploadStore> uploads =
std::make_shared<fw::UploadStore>();
std::shared_ptr<fw::WebdavStore> webdav =
std::make_shared<fw::WebdavStore>();
std::shared_ptr<fw::Supervisor> supervisor =
std::make_shared<fw::Supervisor>();
std::shared_ptr<fw::TaskQueue> tasks = std::make_shared<fw::TaskQueue>();
std::shared_ptr<fw::ReplicationLog> repl =
std::make_shared<fw::ReplicationLog>();
std::shared_ptr<fw::OpenApi> openapi = std::make_shared<fw::OpenApi>();
std::shared_ptr<fw::Environment> templates =
std::make_shared<fw::Environment>();
std::map<std::string, std::string> embedded;
std::string static_root = "example/static";
std::string cookie_secret = "living-example-secret";
};
std::shared_ptr<fw::Application> build_application(Services& services);
void register_index(fw::Router& router, Services& services);
void register_routing_demo(fw::Router& router, Services& services);
void register_chain_demo(std::shared_ptr<fw::Application> app,
Services& services);
void register_data_demo(fw::Router& router, Services& services);
void register_security_demo(fw::Router& router, Services& services);
void register_formats_demo(fw::Router& router, Services& services);
void register_realtime_demo(fw::Router& router, Services& services);
void register_ops_demo(fw::Router& router, Services& services);
void load_templates(Services& services);
void load_embedded(Services& services);
void seed_services(Services& services);
} // namespace molo::example::app