aboutsummaryrefslogtreecommitdiff
path: root/examples/tutorial01/polls
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tutorial01/polls')
-rw-r--r--examples/tutorial01/polls/mod.rs2
-rw-r--r--examples/tutorial01/polls/urls.rs7
-rw-r--r--examples/tutorial01/polls/views.rs5
3 files changed, 14 insertions, 0 deletions
diff --git a/examples/tutorial01/polls/mod.rs b/examples/tutorial01/polls/mod.rs
new file mode 100644
index 0000000..fd1dad8
--- /dev/null
+++ b/examples/tutorial01/polls/mod.rs
@@ -0,0 +1,2 @@
+pub mod urls;
+pub mod views;
diff --git a/examples/tutorial01/polls/urls.rs b/examples/tutorial01/polls/urls.rs
new file mode 100644
index 0000000..e978920
--- /dev/null
+++ b/examples/tutorial01/polls/urls.rs
@@ -0,0 +1,7 @@
+use tosin::urls::Path;
+
+use super::views;
+
+pub const url_patterns: &[Path] = [
+ Path::View { url: "", view: views::index, name: "index" },
+];
diff --git a/examples/tutorial01/polls/views.rs b/examples/tutorial01/polls/views.rs
new file mode 100644
index 0000000..8678e97
--- /dev/null
+++ b/examples/tutorial01/polls/views.rs
@@ -0,0 +1,5 @@
+use tosin::http::{Request, Response};
+
+pub async fn index(request: Request) -> Response {
+ Response("Hello, world. You're at the polls index.")
+}