35 lines
953 B
Rust
35 lines
953 B
Rust
#[macro_use]
|
|
extern crate rocket;
|
|
|
|
use dioxus::core::VirtualDom;
|
|
use rocket::fs::FileServer;
|
|
use rocket_dyn_templates::{Template, context};
|
|
use rust_letter::web_app;
|
|
|
|
#[get("/")]
|
|
async fn index() -> Template {
|
|
let mut vdom = VirtualDom::new(web_app::App);
|
|
let _ = vdom.rebuild();
|
|
let output = dioxus_ssr::render(&vdom);
|
|
Template::render(
|
|
"index",
|
|
context! {
|
|
app_title: "A Letter For You!",
|
|
style_include: "<link href=/styles/tailwind.min.css rel=stylesheet />",
|
|
test: &output
|
|
},
|
|
)
|
|
}
|
|
|
|
#[rocket::main]
|
|
async fn main() -> Result<(), rocket::Error> {
|
|
let _result = rocket::build()
|
|
.mount("/images", FileServer::from("public/images"))
|
|
.mount("/styles", FileServer::from("public/styles"))
|
|
.mount("/fonts", FileServer::from("public/fonts"))
|
|
.mount("/", routes![index]).attach(Template::fairing())
|
|
.launch()
|
|
.await;
|
|
Ok(())
|
|
}
|