aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-04-22 02:17:34 -0600
committerMelody Horn <melody@boringcactus.com>2021-04-22 02:17:34 -0600
commit0b1563bc56cf20f8a63d5b90783294a1eb11ea17 (patch)
tree8c385ce352e03ab6e61b5a54e4bd5c3cfc20afd5 /src
parente56c4bdb4f647a7d7fea47449f6dc6a4004b0436 (diff)
downloadgityeet-0b1563bc56cf20f8a63d5b90783294a1eb11ea17.tar.gz
gityeet-0b1563bc56cf20f8a63d5b90783294a1eb11ea17.zip
get rolling with HTTP and templates
Diffstat (limited to 'src')
-rw-r--r--src/main.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index e7a11a9..cb18c22 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,3 +1,18 @@
-fn main() {
- println!("Hello, world!");
+use askama::Template;
+use tide::prelude::*;
+
+#[derive(Template)]
+#[template(path = "index.html")]
+struct IndexTemplate;
+
+#[async_std::main]
+async fn main() -> tide::Result<()> {
+ let mut app = tide::new();
+ app.at("/").get(index);
+ app.listen("127.0.0.1:8000").await?;
+ Ok(())
+}
+
+async fn index(_: tide::Request<()>) -> tide::Result {
+ Ok(IndexTemplate.into())
}