Skip to content

michaelsproul/static-file

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

static-file Build Status

Static file-serving middleware for the Iron web framework.

Example

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);
}

Overview

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.

Installation

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.

Get Help

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.

About

Static file-serving middleware for the Iron web framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published