summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKjetil Orbekk <kjetil.orbekk@gmail.com>2017-05-24 09:08:48 -0400
committerKjetil Orbekk <kjetil.orbekk@gmail.com>2017-05-24 09:08:48 -0400
commitea9ecc916348f47a4ab0753d753ab4dcfec05f5b (patch)
tree6760a417a296a621f85962df54086776ec49e1c0 /src
parent4ef16c5811344e074f6f0a1a16328af866fa5a79 (diff)
Add css
Diffstat (limited to 'src')
-rw-r--r--src/main.rs11
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();