diff --git a/src/main.rs b/src/main.rs index cd6295d..ef1cc2f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,6 @@ #![feature(advanced_slice_patterns, slice_patterns, box_patterns)] +#![feature(plugin)] +#![plugin(rocket_codegen)] extern crate getopts; extern crate linefeed; extern crate itertools; @@ -9,6 +11,7 @@ extern crate maplit; #[macro_use] extern crate serde_derive; extern crate serde_json; +extern crate rocket; use std::path::Path; use std::fs::File; diff --git a/src/webapp.rs b/src/webapp.rs index 967d92f..e585b7c 100644 --- a/src/webapp.rs +++ b/src/webapp.rs @@ -1,8 +1,12 @@ +use rocket; + +use rocket::response::NamedFile; + #[get("/")] -fn index() -> &'static str { - "rocket test" +fn index() -> Result { + NamedFile::open("static/index.html").map_err(|_| ()) } -fn web_main() { +pub fn web_main() { rocket::ignite().mount("/", routes![index]).launch(); } diff --git a/static/index.html b/static/index.html new file mode 100644 index 0000000..24c40c9 --- /dev/null +++ b/static/index.html @@ -0,0 +1,8 @@ + + + + + + Test + +