Static file-serving middleware for the Iron web framework.
fn main() {
let mut server: Server = Iron::new();
// Serve a favicon
server.chain.link(Static::favicon(Path::new("path/to/favicon")));
// Serve the docs
server.chain.link(Static::new(Path::new("doc/")));
// Serve the index.html
server.chain.link(Static::new(Path::new("doc/staticfile/")));
server.listen(Ipv4Addr(127, 0, 0, 1), 3000);
}
static-file is a part of Iron's core bundle.
- Serve static files from a given path, if available.
- Serve all requests to favicon.ico with a given file.
If you're using a Cargo.toml
to manage dependencies, just add static-file to the toml:
[dependencies.staticfile]
git = "https://github.com/iron/static-file.git"
Otherwise, cargo build
, and the rlib will be in your target
directory.
Along with the online documentation,
you can build a local copy with make doc
.
One of us (@reem, @zzmp,
@theptrk, @mcreinhard)
is usually on #iron
on the mozilla irc. Come say hi and ask any questions you might have.
We are also usually on #rust
and #rust-webdev
.