aboutsummaryrefslogtreecommitdiff
path: root/examples/tutorial01/polls
diff options
context:
space:
mode:
authorMelody Horn / boringcactus <melody@boringcactus.com>2021-06-12 23:24:33 -0600
committerMelody Horn / boringcactus <melody@boringcactus.com>2021-06-12 23:24:33 -0600
commit4c8940569e5729213b7eee6f3d5be39b745b697b (patch)
tree20935676f7a14ad12752ec98b65db9f067fba239 /examples/tutorial01/polls
parent582124d59afa438e2cb88cc024d6b19232236e1e (diff)
downloadtosin-4c8940569e5729213b7eee6f3d5be39b745b697b.tar.gz
tosin-4c8940569e5729213b7eee6f3d5be39b745b697b.zip
actually implement the easy example
Diffstat (limited to 'examples/tutorial01/polls')
-rw-r--r--examples/tutorial01/polls/urls.rs10
-rw-r--r--examples/tutorial01/polls/views.rs6
2 files changed, 9 insertions, 7 deletions
diff --git a/examples/tutorial01/polls/urls.rs b/examples/tutorial01/polls/urls.rs
index d56b8c9..184c6f8 100644
--- a/examples/tutorial01/polls/urls.rs
+++ b/examples/tutorial01/polls/urls.rs
@@ -1,7 +1,9 @@
-use tosin::urls::Path;
+use tosin::http::Filter;
+use tosin::urls::{UrlMap, path};
use super::views;
-pub const URL_PATTERNS: &[Path] = &[
- Path::View { url: "", view: views::index, name: "index" },
-];
+pub fn urls() -> UrlMap {
+ path::end().map(views::index) // TODO name: "index"
+ .boxed()
+}
diff --git a/examples/tutorial01/polls/views.rs b/examples/tutorial01/polls/views.rs
index 23b740d..4859cec 100644
--- a/examples/tutorial01/polls/views.rs
+++ b/examples/tutorial01/polls/views.rs
@@ -1,5 +1,5 @@
-use tosin::http::{Request, Response};
+use tosin::http::{Reply, Response};
-pub fn index(request: Request) -> Response {
- Response("Hello, world. You're at the polls index.")
+pub fn index() -> Response {
+ "Hello, world. You're at the polls index.".into_response()
}