blob: ff9cb5deb46e8dcf7c164f89c8e477965c5395ec [file] [log] [blame]
{{>copyright comment="//"}}
#include <lib/async-loop/cpp/loop.h>
#include <lib/async-loop/default.h>
#include <lib/sys/cpp/component_context.h>
#include <lib/sys/inspect/cpp/component.h>
#include <lib/syslog/cpp/macros.h>
#include "{{PROJECT_PATH}}/{{snake_case PROJECT_NAME}}.h"
int main(int argc, const char** argv) {
// Create the main async event loop.
async::Loop loop(&kAsyncLoopConfigAttachToCurrentThread);
// Create an instance of the application state.
{{snake_case PROJECT_NAME}}::App app(loop.dispatcher());
auto component_context = sys::ComponentContext::CreateAndServeOutgoingDirectory();
// Initialize inspect
sys::ComponentInspector inspector(component_context.get());
inspector.Health().StartingUp();
// Serve a protocol using:
// component_context->outgoing()->AddPublicService<MyProtocol>(..);
inspector.Health().Ok();
FX_LOGS(DEBUG) << "Initialized.";
// Run the loop until it is shutdown.
loop.Run();
return 0;
}