diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index a39d08d..70a19af 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,7 @@ extern crate env_logger; extern crate horrorshow; extern crate systemhttp; extern crate iron_sessionstorage; +extern crate staticfile; use iron_sessionstorage::traits::*; use iron_sessionstorage::SessionStorage; @@ -22,6 +23,7 @@ use router::Router; use horrorshow::prelude::*; use horrorshow::Raw; use systemhttp::systemd::unit; +use staticfile::Static; struct Aaa(String); @@ -41,7 +43,10 @@ fn render_message(message: &str, units: &[unit::Unit]) -> String { (html!{ : Raw("<!DOCTYPE html>"); html { - head { title: "Title"; } + head { + title: "Title"; + link(rel="stylesheet", type="text/css", href="static/main.css"); + } body { p { : message @@ -109,7 +114,9 @@ fn main() { let secret = b"secret2".to_vec(); let router = router!( root: get "/" => hello, - name: get "/:name" => hello); + name: get "/:name" => hello, + css: get "/static/main.css" => Static::new(""), + ); let mut chain = Chain::new(router); chain.link_around(SessionStorage::new(SignedCookieBackend::new(secret))); let _server = Iron::new(chain).http(":::8080").unwrap(); |