https://github.com/http-rs/tide-fs
File system handlers for the Tide web-framework
https://github.com/http-rs/tide-fs
Last synced: about 1 year ago
JSON representation
File system handlers for the Tide web-framework
- Host: GitHub
- URL: https://github.com/http-rs/tide-fs
- Owner: http-rs
- Created: 2021-02-06T13:03:41.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-21T20:42:22.000Z (about 5 years ago)
- Last Synced: 2025-04-08T16:11:12.703Z (about 1 year ago)
- Language: Rust
- Size: 27.3 KB
- Stars: 6
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tide-fs
[](https://github.com/mendelt/tide-fs/actions?query=workflow%3ABuild+event%3Apush+branch%3Amaster)
File system handlers for the Tide web-framework.
Tide-fs contains extensions for the Tide web-framework to serve files or whole directories from your file-system. Tide-fs provides a `ServeDir` and a `ServeFile` endpoint. It also provides a convenient extension trait to the `tide::Route` type that allow you to add these endpoints with the `serve_dir` and `serve_file` methods. `ServeFile` serves a single file on a single route;
```rust
use tide_fs::prelude::*;
let mut app = tide::new();
app.at("index.html").serve_file("examples/content/index.html")?;
```
`ServeDir` maps a section of a route to files in a directory
```rust
use tide_fs::prelude::*;
let mut app = tide::new();
app.at("static/").serve_dir("examples/content/")?;
```