steid

@jamesgill /

steid/src/main.rs
651 BCode·Blame·Raw
1use topcoat::{
2 Result,
3 router::{Router, RouterBuilderDiscoverExt, page},
4 view::{component, view},
5};
6
7#[tokio::main]
8async fn main() {
9 topcoat::start(Router::builder().discover().build())
10 .await
11 .unwrap();
12}
13
14#[page("/")]
15async fn home() -> Result {
16 view! {
17 <!DOCTYPE html>
18 <html>
19 <head>
20 <title>"steid"</title>
21 topcoat::dev::script()
22 </head>
23 <body>
24 heading(name: "steid")
25 </body>
26 </html>
27 }
28}
29
30#[component]
31async fn heading(name: &str) -> Result {
32 view! {
33 <h1>(name)</h1>
34 }
35}