Main.vala 1.0 KB

12345678910111213141516171819202122232425262728293031
  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. Routes come from each page's
  14. // <pstm-uri>; actions are auto-mapped to GUID endpoints; the Statum
  15. // client scripts are embedded by default.
  16. statum.add_page<HomePage, HomeEntrypoint>();
  17. statum.add_page<DashboardPage, DashboardEntrypoint>();
  18. statum.action<LoginAction>();
  19. statum.action<LogoutAction>();
  20. statum.action<BumpCounterAction>();
  21. statum.add_resource<StylesResource>();
  22. application.run();
  23. } catch (Error e) {
  24. printerr("Error: %s\n", e.message);
  25. Process.exit(1);
  26. }
  27. }