tokio-rs/topcoat
原文摘要
A batteries-included framework for building web apps Topcoat The full full-stack framework for Rust Topcoat is a modular, batteries-included Rust framework for building fullstack apps. It prioritizes simplicity and productivity. See Learn Topcoat to get started, or the Roadmap for what's coming next. Early-stage and experimental. Expect breaking changes. use topcoat::{ Result, router::{Router, RouterBuilderDiscoverExt, page}, view::{component, view}, }; #[tokio::main] async fn main() { topcoat::start(Router::builder().discover().build()).await.unwrap(); } #[page("/")] async fn home() -> Result { view! { <!DOCTYPE html> <html> <body> hello(name: "World") </body> </html> } } #[component] async fn hello(name: &str) -> Result { view! { <h1>"Hello, " (name) "!"</h1> } } What makes Topcoat different Client reactivity without the boilerplate Topcoat renders all markup on the server: components can be async and query the database directly, eliminating all the traditional boilerplate needed for a separate API layer. Interactivity does not have to cost a round-trip, though. A $(...) expression is ordinary type-checked Rust that Topcoat evaluates on the server for the initial render and also…
📋 本文为 GitHub Trending Daily RSS 的 RSS 摘要原文,未经 AI 整理。完整上下文请以 原文 为准。