Main.vala 992 B

1234567891011121314151617181920212223242526272829
  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.action<LoginAction>();
  17. statum.action<LogoutAction>();
  18. statum.action<BumpCounterAction>();
  19. statum.add_resource<StylesResource>();
  20. application.run();
  21. } catch (Error e) {
  22. printerr("Error: %s\n", e.message);
  23. Process.exit(1);
  24. }
  25. }