-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: added error pages to
tiny
example
Progresses #153.
- Loading branch information
1 parent
c4c7ed2
commit 4c6d1cf
Showing
1 changed file
with
11 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) } | ||
})) | ||
} |