Crates.io | embed_staticfile |
lib.rs | embed_staticfile |
version | 0.2.0 |
source | src |
created_at | 2017-10-20 09:27:04.948305 |
updated_at | 2017-10-25 02:49:03.256136 |
description | Create embedded static file handler for Iron |
homepage | |
repository | https://github.com/maueki/embed_staticfile.rs |
max_upload_size | |
id | 36330 |
size | 5,957 |
Add this to your Cargo.toml
:
[dependencies]
include_dir_bytes = "0.2"
embed_staticfile = "0.2"
and use them like this:
#![feature(plugin)]
#![plugin(include_dir_bytes)]
extern crate iron;
extern crate mount;
extern crate embed_staticfile;
use iron::prelude::*;
use mount::Mount;
use embed_staticfile::EmbedStatic;
fn main() {
let mut mount = Mount::new();
mount.mount("/assets/", EmbedStatic::new(include_dir!("../assets")));
Iron::new(mount).http("localhost:3000").unwrap();
}