tide-naive-static-files
A simple static file serving component for Rust's Tide web framework.
Acknowledgements
This code is based heavily on this archived example.
Example
To use the library:
- Define some state for your server.
- Implement
StaticRootDir
on your state. This tells the library how to access the name of the root directory in which your static assets live. - Set up a
get
endpoint with a*path
glob pattern (like/static/*path
or/*path
) and have it call theserve_static_files
function.
use ;
use ;
async
Problems
Right now it kinda doesn't use all the async-y-ness that it probably could. There are a couple of unfortunate task::block_on
s that I want to get rid of. Suggestions welcome!