module d_webservice_example.application; import aermicioi.aedi : Container, locate, singleton; import vibe.http.router : URLRouter; void main() @safe { import d_webservice_example.component_registration : registerComponents; import vibe.core.core : runApplication; import vibe.http.server : HTTPServerSettings, listenHTTP; setupLogging; auto container = singleton; scope (exit) container.terminate; container.registerComponents; container.instantiate; auto settings = new HTTPServerSettings; settings.port = 8080; settings.bindAddresses = ["::", "0.0.0.0"]; auto router = setupRouter(container); listenHTTP(settings, router); runApplication; } void setupLogging() nothrow @safe { import vibe.core.log : setLogFormat, FileLogger; debug { import vibe.core.log : LogLevel, setLogLevel; setLogLevel(LogLevel.diagnostic); } setLogFormat(FileLogger.Format.threadTime, FileLogger.Format.threadTime); } URLRouter setupRouter(Container container) @safe { import d_webservice_example.controller.todo_controller : TodoController; import d_webservice_example.controller.todo_notification_controller : TodoNotificationController; import vibe.web.rest : registerRestInterface; import vibe.web.web : registerWebInterface; auto router = new URLRouter; router.registerRestInterface(container.locate!TodoController); router.registerWebInterface(container.locate!TodoNotificationController); return router; }