Segment.fromDirectory constructor
Segment.fromDirectory(
- String directory
Create a new path segment from a directory path.
Implementation
factory Segment.fromDirectory(String directory) {
final Directory folder = Directory(directory);
if (!folder.existsSync()) {
throw FileSystemException('Directory not found', directory);
}
return Segment(
directory: folder.path,
handler: _findFile(folder, 'handler.dart'),
middleware: _findFile(folder, 'middleware.dart'),
paramsMiddleware: _findParamsMiddleware(folder),
configuration: _findConfiguration(folder),
children: _findChildren(folder),
methodSegments: _findMethotSegments(folder),
);
}