ShelfVirtualDirectory class
Creates a instance of ShelfVirtualDirectory
Parameters
-
folderPath
: Name of the directory you want to serve from the current folder -
defaultFile
: File name that will be served. Default: index.html -
default404File
: File name that will be served for 404. Default: 404.html -
showLogs
: Shows logs from the ShelfVirtualDirectory. Default: true
Examples
You can get router or handler or cascade from ShelfVirtualDirectory instance
final virDirRouter = ShelfVirtualDirectory(folderToServe);
final staticFileHandler = const Pipeline()
.addMiddleware(logRequests())
.addHandler(virDirRouter.handler);
io.serve(Cascade().add(staticFileHandler).handler,address,port).then((server){
print('Server is sunning at ${server.address}:${server.port}'),
});
Constructors
- ShelfVirtualDirectory(String folderPath, {String defaultFile = 'index.html', String default404File = '404.html', bool listDirectory = true, FileHeaderParser headersParser = _defaultFileheaderParser})
- Creates a instance of ShelfVirtualDirectory
Properties
- cascade → Cascade
-
Returns a instance of
Cascade
no setter - default404File → String
-
Default 404 file to serve. Must be inside folderPath.
final
- defaultFile → String
-
Default file to serve. Must be inside folderPath.
final
- folderPath → String
-
Absolute path to the directory
final
- handler → Handler
-
Creates a instance of
Handler
no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- listDirectory → bool
-
Weather to list directory or not.
final
- router → Router
-
Returns a instance of
Router
no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited