Crate rocket_static_fs[−][src]
rocket_static_fs implements a simplistic but functional static file server for the rocket framework.
Example
This example works for sharing the src folder of your app.
#![feature(plugin)] #![plugin(rocket_codegen)] extern crate rocket; extern crate rocket_static_fs; use rocket_static_fs::{StaticFileServer, OptionsBuilder, fs}; #[get("/")] fn index() -> &'static str { "Hello, world!" } fn main() { let fs = fs::LocalFileSystem::new("src"); let options = OptionsBuilder::new().prefix("/src").into(); rocket::ignite() .attach(StaticFileServer::new(fs, options).unwrap()) .mount("/", routes![index]) .launch(); }
Modules
fs |
Includes the FileSystem trait and built-in implementations. |
Structs
Options | |
OptionsBuilder | |
StaticFileServer |
StaticFileServer is your fairing for the static file server. |