You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.
We should add the method serveIndexFile to teh VirtualDirectory class as well. Then one can have a custom directory handler which can forward to the index file, e.g.
staticFiles.directoryHandler = (dir, request) {
if (...) {
// Handle some directory requests here.
} else {
// Redirect all other directory requests to the index file.
staticFiles.serveIndexFile(dir, request);
}
};
<img src="https://avatars.githubusercontent.com/u/5479?v=3" align="left" width="96" height="96"hspace="10"> Issue by sethladd
Originally opened as dart-lang/sdk#15765
It would be really nice to easily set the directory index file for http_server.
Currently we have to do this:
staticFiles.directoryHandler = (dir, request) {
// Redirect directory-requests to index.html files.
var indexUri = new Uri.file(dir.path).resolve('index.html');
staticFiles.serveFile(new File(indexUri.toFilePath()), request);
};
In the future, I'd love to be able to do this:
staticFiles.directoryIndexFilename = 'index.html';
And we could make it also take an array of options:
staticFiles.directoryIndexFilename = ['index.html', 'home.html'];
The text was updated successfully, but these errors were encountered: