tide.rs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //!
  2. //!
  3. //!
  4. use dioxus::virtual_dom::VirtualDom;
  5. use dioxus_core as dioxus;
  6. use dioxus_core::prelude::*;
  7. use dioxus_core_macro::*;
  8. use dioxus_hooks::use_state;
  9. use dioxus_html as dioxus_elements;
  10. fn main() {}
  11. // use tide::{Request, Response};
  12. // #[async_std::main]
  13. // async fn main() -> Result<(), std::io::Error> {
  14. // let mut app = tide::new();
  15. // app.at("/:name").get(|req: Request<()>| async move {
  16. // let initial_name: String = req
  17. // .param("name")
  18. // .map(|f| f.parse().unwrap_or("...?".to_string()))
  19. // .unwrap_or("...?".to_string());
  20. // let mut dom = VirtualDom::new_with_props(Example, ExampleProps { initial_name });
  21. // dom.rebuild();
  22. // Ok(Response::builder(200)
  23. // .body(format!("{}", dioxus_ssr::render_vdom(&dom, |c| c)))
  24. // .content_type(tide::http::mime::HTML)
  25. // .build())
  26. // });
  27. // println!("Server available at [http://127.0.0.1:8080/bill]");
  28. // app.listen("127.0.0.1:8080").await?;
  29. // Ok(())
  30. // }
  31. // #[derive(PartialEq, Props)]
  32. // struct ExampleProps {
  33. // initial_name: String,
  34. // }
  35. // static Example: FC<ExampleProps> = |cx, props| {
  36. // let dispaly_name = use_state(cx, move || props.initial_name.clone());
  37. // cx.render(rsx! {
  38. // div { class: "py-12 px-4 text-center w-full max-w-2xl mx-auto",
  39. // span { class: "text-sm font-semibold"
  40. // "Dioxus Example: Jack and Jill"
  41. // }
  42. // h2 { class: "text-5xl mt-2 mb-6 leading-tight font-semibold font-heading"
  43. // "Hello, {dispaly_name}"
  44. // }
  45. // ul {
  46. // {(0..10).map(|f| rsx!( li {"Element {f}"} ))}
  47. // }
  48. // }
  49. // })
  50. // };