Skip to content

Commit

Permalink
refactor: added error pages to tiny example
Browse files Browse the repository at this point in the history
Progresses #153.
  • Loading branch information
arctic-hen7 committed Jun 20, 2022
1 parent c4c7ed2 commit 4c6d1cf
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions examples/comprehensive/tiny/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
use perseus::{Html, PerseusApp, Template};
use perseus::{Html, PerseusApp, Template, ErrorPages};
use sycamore::view;

#[perseus::main]
pub fn main<G: Html>() -> PerseusApp<G> {
PerseusApp::new().template(|| {
Template::new("index").template(|cx, _| {
view! { cx,
p { "Hello World!" }
}
PerseusApp::new()
.template(|| {
Template::new("index").template(|cx, _| {
view! { cx,
p { "Hello World!" }
}
})
})
})
.error_pages(|| ErrorPages::new(|cx, url, status, err, _| view! { cx
p { (format!("An error with HTTP code {} occurred at '{}': '{}'.", status, url, err)) }
}))
}

0 comments on commit 4c6d1cf

Please sign in to comment.