| 1234567891011121314151617181920212223242526272829 |
- using Astralis;
- using Inversion;
- using Statum;
- using Example;
- void main(string[] args) {
- int port = args.length > 1 ? int.parse(args[1]) : 8080;
- try {
- var application = new WebApplication(port);
- application.use_compression();
- application.add_module<StatumModule>();
- var statum = application.configure_with<StatumConfigurator>();
- // HomePage is generated from home.html; HomeEntrypoint hydrates it.
- // The Statum client scripts (statum.js / statum-worker.js) are embedded in
- // the library and served by default, so only the page-specific CSS needs
- // registering here.
- statum.add_entrypoint_page<HomePage, HomeEntrypoint>(new EndpointRoute("/"));
- statum.add_action<LoginAction>(new EndpointRoute("/login", Method.POST));
- statum.add_action<LogoutAction>(new EndpointRoute("/logout", Method.POST));
- statum.add_resource<StylesResource>();
- application.run();
- } catch (Error e) {
- printerr("Error: %s\n", e.message);
- Process.exit(1);
- }
- }
|