platform/packages/static/test/cache_sample.dart
2024-10-12 03:35:14 -07:00

27 lines
754 B
Dart

import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_framework/http.dart';
import 'package:angel3_static/angel3_static.dart';
import 'package:file/local.dart';
void main() async {
Protevus app;
ProtevusHttp http;
var testDir = const LocalFileSystem().directory('test');
app = Protevus();
http = ProtevusHttp(app);
app.fallback(
CachingVirtualDirectory(app, const LocalFileSystem(),
source: testDir,
maxAge: 350,
onlyInProduction: false,
indexFileNames: ['index.txt']).handleRequest,
);
app.get('*', (req, res) => 'Fallback');
app.dumpTree(showMatchers: true);
var server = await http.startServer();
print('Open at http://${server.address.host}:${server.port}');
}