| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- using Astralis;
- using Invercargill;
- using Inversion;
- using Spry;
- /**
- * Main.vala - Spry Framework Website
- *
- * A modern, techy website showcasing the Spry framework and its ecosystem:
- * - Astralis: High-performance web server framework
- * - Inversion: Dependency injection container
- * - Spry: Component-based HTMX web framework
- *
- * Features:
- * - Clean, eye-catching design with purple/blue/green theme
- * - Interactive particle demo showcasing real-time HTMX updates
- * - Responsive layout with modern CSS
- * - Free/Libre open source spirit
- */
- void main(string[] args) {
- int port = args.length > 1 ? int.parse(args[1]) : 8080;
-
- print("═══════════════════════════════════════════════════════════════\n");
- print(" 🚀 Spry Framework Website\n");
- print("═══════════════════════════════════════════════════════════════\n");
- print(" Port: %d\n", port);
- print("═══════════════════════════════════════════════════════════════\n");
- print(" Pages:\n");
- print(" / - Home\n");
- print(" /features - Features\n");
- print(" /ecosystem - Ecosystem (Astralis, Inversion, Spry)\n");
- print(" /demo - Interactive Demo\n");
- print(" /freedom - Free/Libre Philosophy\n");
- print("═══════════════════════════════════════════════════════════════\n");
- print("\nPress Ctrl+C to stop the server\n\n");
-
- try {
- var application = new WebApplication(port);
-
- // Enable compression
- application.use_compression();
-
- // Add Spry module for component actions
- application.add_module<SpryModule>();
-
- // Register stores as singletons
- application.add_singleton<AuroraState>();
-
- // Configure templates
- var spry_cfg = application.configure_with<SpryConfigurator>();
- spry_cfg.add_template<SiteLayoutTemplate>("");
-
- // Register page components
- application.add_transient<HomePage>();
- application.add_endpoint<HomePage>(new EndpointRoute(HomePage.ROUTE));
-
- application.add_transient<FeaturesPage>();
- application.add_endpoint<FeaturesPage>(new EndpointRoute(FeaturesPage.ROUTE));
-
- application.add_transient<EcosystemPage>();
- application.add_endpoint<EcosystemPage>(new EndpointRoute(EcosystemPage.ROUTE));
-
- application.add_transient<DemoPage>();
- application.add_endpoint<DemoPage>(new EndpointRoute(DemoPage.ROUTE));
-
- application.add_transient<FreedomPage>();
- application.add_endpoint<FreedomPage>(new EndpointRoute(FreedomPage.ROUTE));
-
- // Register interactive components (for spry-action)
- application.add_transient<AuroraWaveComponent>();
- application.add_transient<AuroraCanvasEndpoint>();
- application.add_transient<AuroraStatsEndpoint>();
- application.add_transient<FeatureCardComponent>();
- application.add_transient<CodeBlockComponent>();
- application.add_transient<StatCardComponent>();
-
- // Register CSS as FastResources
- application.add_startup_endpoint<FastResource>(new EndpointRoute("/styles/main.css"), () => {
- try {
- return new FastResource.from_string(Styles.MAIN_CSS)
- .with_content_type("text/css; charset=utf-8")
- .with_default_compressors();
- } catch (Error e) {
- error("Failed to create main CSS resource: %s", e.message);
- }
- });
-
- application.run();
-
- } catch (Error e) {
- printerr("Error: %s\n", e.message);
- Process.exit(1);
- }
- }
|