Files
soda/examples/hello.rs
2025-02-13 15:08:59 -05:00

20 lines
730 B
Rust

// A very, very simple static composer example.
extern crate soda;
use soda::prelude::*;
#[tokio::main]
async fn main() {
let page = PageBase("Test Page",
(
Tag::Heading1("Hello, World!"),
Tag::Paragraph("This is a test of Soda, an ultrafast composable frontend framework built in Rust!")
)
);
let app = page.route();
Server::new(([0, 0, 0, 0], 3000)).await.unwrap().serve(app, ()).await.unwrap();
// weird rustc bug: if the second argument is omitted, rustc gets stuck in a recursion trying to figure out what type State is
// *before* exiting on the error produced by the missing argument. this consumes cpu and slowly eats ram until it OOMs or you kill it.
}