d-webservice-example/source/d_webservice_example/application.d

27 lines
695 B
D
Raw Normal View History

2018-12-18 22:18:06 +01:00
module d_webservice_example.application;
import aermicioi.aedi : locate, singleton;
import vibe.vibe;
void main() @safe
{
import d_webservice_example.component_registration : registerComponents;
import d_webservice_example.controller.todo_controller : TodoController;
auto container = singleton;
2018-12-18 22:18:06 +01:00
scope (exit)
container.terminate;
container.registerComponents;
2018-12-18 22:18:06 +01:00
container.instantiate;
auto router = new URLRouter;
router.registerRestInterface(container.locate!TodoController);
auto settings = new HTTPServerSettings;
settings.port = 8080;
settings.bindAddresses = ["::", "0.0.0.0"];
listenHTTP(settings, router);
runApplication;
2018-12-18 22:18:06 +01:00
}