From e2b1db599b2ef443b2fe2def6840105539678473 Mon Sep 17 00:00:00 2001
From: Antoine Gersant <antoine.gersant@lesforges.org>
Date: Sun, 28 Aug 2016 19:21:44 -0700
Subject: [PATCH] Serve web client

---
 .gitmodules |  3 +++
 Cargo.lock  | 13 +++++++++++++
 Cargo.toml  |  1 +
 src/main.rs |  3 +++
 web         |  1 +
 5 files changed, 21 insertions(+)
 create mode 100644 .gitmodules
 create mode 160000 web

diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..ef8cc0c
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "web"]
+	path = web
+	url = https://github.com/agersant/polaris-web.git
diff --git a/Cargo.lock b/Cargo.lock
index f954a3a..b558eea 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6,6 +6,7 @@ dependencies = [
  "mount 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "router 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
+ "staticfile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "toml 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "url 1.2.0 (git+https://github.com/servo/rust-url)",
 ]
@@ -224,6 +225,18 @@ dependencies = [
  "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "staticfile"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "iron 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "mount 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "time"
 version = "0.1.35"
diff --git a/Cargo.toml b/Cargo.toml
index 6504f84..be59382 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,6 +15,7 @@ rustc-serialize = "0.3"
 [dependencies]
 router = "*"
 mount  = "*"
+staticfile = "*"
 
 [dependencies]
 toml = "0.2"
\ No newline at end of file
diff --git a/src/main.rs b/src/main.rs
index eab6b80..8ddef39 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -2,6 +2,7 @@ extern crate core;
 extern crate iron;
 extern crate mount;
 extern crate rustc_serialize;
+extern crate staticfile;
 extern crate toml;
 extern crate url;
 
@@ -11,6 +12,7 @@ use std::sync::Mutex;
 
 use iron::prelude::*;
 use mount::Mount;
+use staticfile::Static;
 
 mod api;
 mod collection;
@@ -30,6 +32,7 @@ fn main() {
     let mut mount = Mount::new();
     let api_handler = get_api_handler(collection);
     mount.mount("/api/", api_handler);
+    mount.mount("/", Static::new(Path::new("web")));
 
     Iron::new(mount).http("localhost:3000").unwrap();
 }
diff --git a/web b/web
new file mode 160000
index 0000000..93516f2
--- /dev/null
+++ b/web
@@ -0,0 +1 @@
+Subproject commit 93516f23734f9e36fcf0d3aaa4244082faf26acd