12 releases (4 breaking)
Uses old Rust 2015
0.5.1 | Apr 19, 2018 |
---|---|
0.5.0 | Apr 19, 2018 |
0.4.0 | Apr 17, 2018 |
0.3.3 | Apr 16, 2018 |
0.1.3 | Apr 12, 2018 |
#29 in #rocket-framework
52 downloads per month
44KB
909 lines
rocket_static_fs
A simple static file server for Rust's rocket framework.
Features
- Basic HTTP caching via Last-Modified header
Content-Encoding
support (gzip and deflate)Range
support (no multipart ranges yet)- Support for multiple file backends:
- LocalFileSystem => serve files from a local directory
- EmbeddedFileSystem => serve files which are bundled into the binary
- An example for that is documented on the EmbeddedFileSystem struct
- You can add your own FileSystem implementations by implementing the fs::FileSystem trait
- Directory listing support (no defaulting to certain files right now (e.g. index.html))
Todos
- Cache-Control header rules
- Directory listing default index file
Suggestions / Contributions?
Submit an issue/PR. But in almost all cases it's better to first open an issue before submitting a PR, so you don't waste your time implementing a PR which may get rejected.
Testing
Currently testing is a little bit weird. Before testing, you should cargo run
once,
to create a test package for the fs::embedded::Package
test.
Then you can test with cargo test --all-features
since the fs::embedded::Package
test is
currently behind a feature flag.
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Dependencies
~19–30MB
~548K SLoC