docs.rs failed to build staticdir-0.3.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
staticdir
Serving directory contents for Iron web-framework. Documentation can be found here.
Purpose
Provides the list of files and directories in a mounted folder. To respond with files use staticfile along with this one. See examples.
Example
Start web server at http://localhost:3000 and mount current directory. List of directory contents will be available as JSON.
extern crate staticdir;
extern crate iron;
use *;
use ;
This code will return you
Customize behavior
You can customize the response using ResponseStrategy trait. Suppose you need an HTML response instead of JSON:
extern crate staticdir;
extern crate iron;
use *;
use Status;
use ;
use ReadDir;
use Mime;
;
This will return an HTML page with next contents
* Cargo.toml
* src
* .git
Working with iron components
You can use other modules of iron core bundle like staticfile and mount. In next example you will receive both directory listing and static files.
extern crate staticdir;
extern crate iron;
extern crate mount;
extern crate staticfile;
use *;
use Mount;
use ;
use Static;