main.rs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. use dioxus_core::patch::Edit;
  2. use dioxus_core::prelude::*;
  3. static SERVER_RENDERED_KEY: &'static str = "abc123";
  4. #[derive(Debug, PartialEq, Props)]
  5. struct ServerRendered {
  6. name0: String,
  7. name1: String,
  8. name2: String,
  9. name3: String,
  10. name4: String,
  11. name5: String,
  12. name6: String,
  13. name7: String,
  14. }
  15. fn main() {}
  16. #[cfg(old)]
  17. fn blah() {
  18. // connect to the host server
  19. let server_rendered = use_server_rendered((111111, 11111, 11), SERVER_RENDERED_KEY, || {
  20. ServerRendered {
  21. name0: "abc".to_string(),
  22. name1: "abc".to_string(),
  23. name2: "abc".to_string(),
  24. name3: "abc".to_string(),
  25. name4: "abc".to_string(),
  26. name5: "abc".to_string(),
  27. name6: "abc".to_string(),
  28. name7: "abc".to_string(),
  29. }
  30. });
  31. let handler = dioxus_liveview::new_handler()
  32. .from_directory("abc123") // serve a given directory as the root
  33. .with_context(|| SomeContext {}) // build out a new context for all of the server-rendered components to share
  34. .with_route(SERVER_RENDERED_KEY, |cx: &ServerRendered| {
  35. //
  36. })
  37. .with_route(SERVER_RENDERED_KEY, |cx| {
  38. //
  39. })
  40. .with_route(SERVER_RENDERED_KEY, |cx| {
  41. //
  42. })
  43. .with_route(SERVER_RENDERED_KEY, |cx| {
  44. //
  45. })
  46. .with_route(SERVER_RENDERED_KEY, |cx| {
  47. //
  48. })
  49. .with_route(SERVER_RENDERED_KEY, |cx| {
  50. //
  51. })
  52. // depend on the framework, build a different type of handler
  53. // there are instructions on how to integrate this the various rusty web frameworks in the guide
  54. .build();
  55. server.get("abc", handler);
  56. }
  57. fn use_server_rendered<F: Properties>(_p: impl PartialEq, name: &'static str, f: impl Fn() -> F) {}