Update README.md

This commit is contained in:
Tobe O 2017-03-31 21:08:01 -04:00 committed by GitHub
parent be2092b033
commit f2822fba00

View file

@ -35,6 +35,17 @@ main() async {
}
```
# Push State Example
```dart
var vDir = new VirtualDirectory(...);
var indexFile = new File.fromUri(vDir.source.uri.resolve('index.html'));
app.after.add((req, ResponseContext res) {
// Fallback to index.html on 404
return res.sendFile(indexFile);
});
```
# Options
The `VirtualDirectory` API accepts a few named parameters:
- **source**: A `Directory` containing the files to be served. If left null, then Angel will serve either from `web` (in development) or
@ -46,4 +57,4 @@ The `VirtualDirectory` API accepts a few named parameters:
- **debug**: Print verbose debug output.
- **callback**: Runs before sending a file to a client. Use this to set headers, etc. If it returns anything other than `null` or `true`,
then the callback's result will be sent to the user, instead of the file contents.
- **streamToIO**: If set to `true`, files will be streamed to `res.io`, instead of added to `res.buffer`.. Default is `false`.
- **streamToIO**: If set to `true`, files will be streamed to `res.io`, instead of added to `res.buffer`.. Default is `false`.