Main.vala 1.1 KB

123456789101112131415161718192021222324252627282930
  1. using Astralis;
  2. using Inversion;
  3. using Statum;
  4. using Example;
  5. void main(string[] args) {
  6. int port = args.length > 1 ? int.parse(args[1]) : 8080;
  7. try {
  8. var application = new WebApplication(port);
  9. application.use_compression();
  10. application.add_module<StatumModule>();
  11. var statum = application.configure_with<StatumConfigurator>();
  12. // HomePage is generated from home.html; HomeEntrypoint hydrates it and
  13. // embeds the login/bump action references. Actions are auto-mapped to
  14. // GUID endpoints; the Statum client scripts are embedded by default.
  15. statum.add_entrypoint_page<HomePage, HomeEntrypoint>(new EndpointRoute("/"));
  16. statum.add_entrypoint_page<DashboardPage, DashboardEntrypoint>(new EndpointRoute("/dashboard"));
  17. statum.action<LoginAction>();
  18. statum.action<LogoutAction>();
  19. statum.action<BumpCounterAction>();
  20. statum.add_resource<StylesResource>();
  21. application.run();
  22. } catch (Error e) {
  23. printerr("Error: %s\n", e.message);
  24. Process.exit(1);
  25. }
  26. }