Skip to content

Latest commit

 

History

110 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deprecation Notice

This middleware has been renamed to static.
Static-file will no longer be maintained, but is left here for the sake of lingering dependencies.

You should update your Cargo.toml to use static at its new location: https://github.com/iron/static.


static-file Build Status

Static file-serving handler for the Iron web framework.

Example

This example uses the mounting handler to serve files from several directories.

let mut mount = Mount::new();

// Serve the shared JS/CSS at /
mount.mount("/", Static::new(Path::new("target/doc/")));
// Serve the static file docs at /doc/
mount.mount("/doc/", Static::new(Path::new("target/doc/static_file/")));
// Serve the source code at /src/
mount.mount("/src/", Static::new(Path::new("target/doc/src/static_file/src/lib.rs.html")));

Iron::new(mount).listen(Ipv4Addr(127, 0, 0, 1), 3000);

See examples/doc_server.rs for a complete example that you can compile.

Overview

static-file is a part of Iron's core bundle.

  • Serve static files from a given path.

It works well in combination with the mounting handler.

Installation

If you're using a Cargo.toml to manage dependencies, just add the static_file package to the toml:

[dependencies.static_file]

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 cargo 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

Contributing

Stars

4 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages