Support configurable backend for ServeDir #309
Labels
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
E-hard
Call for participation: Experience needed to fix: Hard / a lot
We've heard from several users who want to use
ServeDir
(orServeFile
) with files that are embedded in the binary, perhaps using rust-embed. By usingServeDir
they'd get a lot for free such as finding the file from the path, range requests, pre-compressed files, etc.That isn't possible today since
ServeDir
is hardcoded to always fetch files from the filesystem. I've been thinking that it could be solved by making a "backend" trait that tellsServeDir
how to open files and get metadata. Something like:Then tower-http could provide a default backend that uses the file system but allow others to write their own.
This should be possible without breaking changes so not adding it to the 0.4 milestone.
The text was updated successfully, but these errors were encountered: