From bd3099526fe08101cbc8377e28df536ac13b6924 Mon Sep 17 00:00:00 2001 From: arctic_hen7 Date: Fri, 15 Apr 2022 11:53:13 +0930 Subject: [PATCH] docs: updated readme code example --- README.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a5765b282e..1111b6fa45 100644 --- a/README.md +++ b/README.md @@ -23,18 +23,20 @@ Perseus is a blazingly fast frontend web development framework built in Rust wit Here's a taste of Perseus (see [the _tiny_ example](https://github.com/arctic-hen7/perseus/tree/main/examples/comprehensive/tiny) for more): ```rust -use perseus::{define_app, ErrorPages, Template}; +use perseus::{Html, PerseusApp, Template}; use sycamore::view; -define_app! { - templates: [ - Template::::new("index").template(|_| view! { - p { "Hello World!" } + +#[perseus::main] +pub fn main() -> PerseusApp { + PerseusApp::new().template(|| { + Template::new("index").template(|_| { + view! { + p { "Hello World!" } + } }) - ], - error_pages: ErrorPages::new(|url, status, err, _| view! { - p { (format!("An error with HTTP code {} occurred at '{}': '{}'.", status, url, err)) } }) } + ``` Check out [the book](https://arctic-hen7.github.io/perseus/en-US) to learn how to turn that into your next app!