Update README.md
This commit is contained in:
parent
be2092b033
commit
f2822fba00
1 changed files with 12 additions and 1 deletions
13
README.md
13
README.md
|
@ -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
|
# Options
|
||||||
The `VirtualDirectory` API accepts a few named parameters:
|
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
|
- **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.
|
- **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`,
|
- **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.
|
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`.
|
||||||
|
|
Loading…
Reference in a new issue