static function
Middleware to handle static content.
Implementation
Callback static(String directory) {
return (Req req, Res res) async {
final dir = cleanPath(directory);
final path = cleanPath(req.uriString);
final file = File('$dir/$path');
if (file.existsSync()) {
await res.sendFile(file);
}
};
}